1
This commit is contained in:
30
unity/Assets/Script/GameObject/Other/CameraMove.cs
Normal file
30
unity/Assets/Script/GameObject/Other/CameraMove.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraMove : MonoBehaviour
|
||||
{
|
||||
private Transform player;
|
||||
void Start()
|
||||
{
|
||||
player = GameObject.FindGameObjectWithTag("Player").transform;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
//RaycastHit[] hits;
|
||||
|
||||
//hits = Physics.RaycastAll(ray, Mathf.Infinity, badMask);
|
||||
//for (int i = 0; i < hits.Length; i++)
|
||||
//{
|
||||
// Debug.Log(hits[i].collider.gameObject.name);
|
||||
//}
|
||||
//Debug.Log(hits.Length);
|
||||
|
||||
if (player!=null)
|
||||
{
|
||||
transform.position = new Vector3(player.position.x, player.position.y - 11, player.position.z);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
11
unity/Assets/Script/GameObject/Other/CameraMove.cs.meta
Normal file
11
unity/Assets/Script/GameObject/Other/CameraMove.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 066236bbf8c0b6f4ab7929aa5dfec2bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
63
unity/Assets/Script/GameObject/Other/CameraVR.cs
Normal file
63
unity/Assets/Script/GameObject/Other/CameraVR.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cinemachine;
|
||||
|
||||
public class CameraVR : MonoBehaviour
|
||||
{
|
||||
private CinemachineVirtualCamera _cinemachineVirtualCamera;
|
||||
private CinemachineBasicMultiChannelPerlin _multiChannelPerlin;
|
||||
|
||||
//当前持续时间
|
||||
private float _shakeTime;
|
||||
//总时间
|
||||
private float _shakeTimeTotal;
|
||||
//强度
|
||||
private float _shakeIntensity;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
||||
_cinemachineVirtualCamera = GetComponent<CinemachineVirtualCamera>();
|
||||
|
||||
_multiChannelPerlin = _cinemachineVirtualCamera.GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>();
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (_shakeTime > 0)
|
||||
{
|
||||
_shakeTime -= Time.deltaTime;
|
||||
_multiChannelPerlin.m_AmplitudeGain = Mathf.Lerp(0, _shakeIntensity, _shakeTime / _shakeTimeTotal);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 抖动
|
||||
/// </summary>
|
||||
/// <param name="Time">抖动时间</param>
|
||||
/// <param name="Intensity">强度</param>
|
||||
public void ShakeCamera(float time, float intensity)
|
||||
{
|
||||
if (_cinemachineVirtualCamera != null)
|
||||
{
|
||||
_shakeTimeTotal = time;
|
||||
_shakeIntensity = intensity;
|
||||
|
||||
_shakeTime = _shakeTimeTotal;
|
||||
_multiChannelPerlin.m_AmplitudeGain = _shakeIntensity;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
Ray ray = new Ray(transform.position, transform.forward);
|
||||
Gizmos.color = Color.blue;
|
||||
|
||||
Gizmos.DrawRay(ray);
|
||||
|
||||
}
|
||||
}
|
||||
11
unity/Assets/Script/GameObject/Other/CameraVR.cs.meta
Normal file
11
unity/Assets/Script/GameObject/Other/CameraVR.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab12f70a05a6b764ca991a34facaca96
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
44
unity/Assets/Script/GameObject/Other/Destructeable.cs
Normal file
44
unity/Assets/Script/GameObject/Other/Destructeable.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Destructeable : MonoBehaviour
|
||||
{
|
||||
public GameObject destoryVFX;
|
||||
public GameObject big;
|
||||
public GameObject small;
|
||||
|
||||
private bool isDestory=false;
|
||||
public float reTiem = 5;
|
||||
|
||||
public void OnDestoryObject()
|
||||
{
|
||||
if (isDestory)
|
||||
return;
|
||||
if (destoryVFX != null)
|
||||
{
|
||||
Instantiate(destoryVFX,transform.position,transform.rotation);
|
||||
}
|
||||
|
||||
big.SetActive(false);
|
||||
SmallActive(true);
|
||||
isDestory = true;
|
||||
StartCoroutine(nameof(DestoryTime));
|
||||
}
|
||||
|
||||
IEnumerator DestoryTime()
|
||||
{
|
||||
yield return new WaitForSeconds(reTiem);
|
||||
big.SetActive(true);
|
||||
SmallActive(false);
|
||||
}
|
||||
|
||||
private void SmallActive(bool active)
|
||||
{
|
||||
if (small != null)
|
||||
{
|
||||
small.SetActive(active);
|
||||
isDestory = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
unity/Assets/Script/GameObject/Other/Destructeable.cs.meta
Normal file
11
unity/Assets/Script/GameObject/Other/Destructeable.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 17918bd11b9ebbe4aa8f98fc6b565daa
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
44
unity/Assets/Script/GameObject/Other/Door.cs
Normal file
44
unity/Assets/Script/GameObject/Other/Door.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Door : MonoBehaviour
|
||||
{
|
||||
public Animator _ani;
|
||||
public BoxCollider2D bx;
|
||||
public bool isOpen=false;
|
||||
public GameObject boss;
|
||||
private void Awake()
|
||||
{
|
||||
_ani = GetComponentInChildren<Animator>();
|
||||
bx = GetComponent<BoxCollider2D>();
|
||||
boss = GameObject.FindWithTag("Boss");
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if(isOpen)
|
||||
{
|
||||
Debug.Log("¿ªÃÅ");
|
||||
_ani.Play("activate");
|
||||
|
||||
StartCoroutine(nameof(Open));
|
||||
|
||||
}
|
||||
}
|
||||
private void OnCollisionEnter2D(Collision2D collision)
|
||||
{
|
||||
if (collision.gameObject.CompareTag("Player")&&!isOpen)
|
||||
{
|
||||
UIManager.Instance.Show<UIOpen>();
|
||||
}
|
||||
}
|
||||
private IEnumerator Open()
|
||||
{
|
||||
yield return new WaitForSeconds(7f);
|
||||
|
||||
bx.isTrigger = true;
|
||||
boss.GetComponentInChildren<BossAI>().SetBegin(true);
|
||||
isOpen=false;
|
||||
this.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
unity/Assets/Script/GameObject/Other/Door.cs.meta
Normal file
11
unity/Assets/Script/GameObject/Other/Door.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af5df1265cd523f41a62497ebb5a4616
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
30
unity/Assets/Script/GameObject/Other/FacingCamera.cs
Normal file
30
unity/Assets/Script/GameObject/Other/FacingCamera.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class FacingCamera : MonoBehaviour
|
||||
{
|
||||
Transform[] childs;
|
||||
private Transform cameraMain;
|
||||
private void Awake()
|
||||
{
|
||||
cameraMain = GameObject.FindGameObjectWithTag("Camera").transform;
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
childs = new Transform[transform.childCount];
|
||||
for (int i = 0; i < transform.childCount; i++)
|
||||
{
|
||||
childs[i] = transform.GetChild(i);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
for (int i = 0; i < childs.Length; i++)
|
||||
{
|
||||
childs[i].rotation = cameraMain.rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
unity/Assets/Script/GameObject/Other/FacingCamera.cs.meta
Normal file
11
unity/Assets/Script/GameObject/Other/FacingCamera.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 198a8841e3728a9498e9d94c5c795c9f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
48
unity/Assets/Script/GameObject/Other/Teleport.cs
Normal file
48
unity/Assets/Script/GameObject/Other/Teleport.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Manager;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Teleport : MonoBehaviour
|
||||
{
|
||||
public BossAI m;
|
||||
public bool isBattle;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if(isBattle)
|
||||
{
|
||||
m = GameObject.FindWithTag("Boss").GetComponentInChildren<BossAI>();
|
||||
}
|
||||
}
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if(isBattle)
|
||||
{
|
||||
if (m.GetIsDie() && collision.CompareTag("Player"))
|
||||
{
|
||||
Debug.Log("传送");
|
||||
//保存玩家信息
|
||||
CharacterCombat cm = collision.gameObject.GetComponentInChildren<CharacterCombat>();
|
||||
PlayerInfo.Instance.KeepData(cm.maxHp, cm.currentHp, cm.attack);
|
||||
|
||||
UIManager.Instance.Show<UILoad>();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (collision.CompareTag("Player"))
|
||||
{
|
||||
Debug.Log("传送");
|
||||
|
||||
//保存玩家信息
|
||||
CharacterCombat cm = collision.gameObject.GetComponentInChildren<CharacterCombat>();
|
||||
PlayerInfo.Instance.KeepData(cm.maxHp,cm.currentHp,cm.attack);
|
||||
|
||||
UIManager.Instance.Show<UILoad>();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
unity/Assets/Script/GameObject/Other/Teleport.cs.meta
Normal file
11
unity/Assets/Script/GameObject/Other/Teleport.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7bba0cc35dabde64da5b08e8c99eefc5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
31
unity/Assets/Script/GameObject/Other/Tree.cs
Normal file
31
unity/Assets/Script/GameObject/Other/Tree.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Spine;
|
||||
using Spine.Unity;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Tree : CombaSystem
|
||||
{
|
||||
private SkeletonAnimation skelet;
|
||||
private Spine.AnimationState animationState;
|
||||
protected override void Awake()
|
||||
{
|
||||
skelet = GetComponent<SkeletonAnimation>();
|
||||
|
||||
animationState = skelet.AnimationState;
|
||||
//¶¯×÷Íê³ÉºóµÄ»Øµ÷
|
||||
animationState.Complete += OnIdle;
|
||||
|
||||
}
|
||||
|
||||
private void OnIdle(TrackEntry trackEntry)
|
||||
{
|
||||
TrackEntry entry = skelet.AnimationState.SetAnimation(0, "animation", true);
|
||||
}
|
||||
|
||||
public override void TakeDamage()
|
||||
{
|
||||
TrackEntry entry = skelet.AnimationState.SetAnimation(0, "hit", false);
|
||||
}
|
||||
}
|
||||
11
unity/Assets/Script/GameObject/Other/Tree.cs.meta
Normal file
11
unity/Assets/Script/GameObject/Other/Tree.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a91b2a7dfd575254eb6845acb24bcf75
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user