123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- using System.Threading.Tasks;
- using UnityEngine;
- namespace WS
- {
- [ObjectSystem]
- public class JumpToComponentLateUpdateSystem : LateUpdateSystem<JumpToComponent>
- {
- public override void LateUpdate(JumpToComponent self)
- {
- self.LateUpdate();
- }
- }
- public class JumpToComponent : OperateComponent<JumpToData>
- {
- private GameObject start;
-
- private VoiceEntity Voice;
- public override void Init() { }
- public override void StartOperate()
- {
- if (start == null)
- {
- start = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/TransferPoint"));
- }
- Voice = VoiceManager.Instance.Play(VoiceType.Voice, OperateData.audioName);
- switch (GameManager.Instance.Data.Pattern)
- {
- case PatternType.教学:
- break;
- case PatternType.练习:
- break;
- case PatternType.考核:
- break;
- }
- start.transform.position = OperateData.startPos;
- }
- public void LateUpdate()
- {
-
-
-
-
-
-
-
-
-
- }
- public override Task StartState()
- {
- if (start == null)
- {
- start = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/TeleportPoint"));
- }
- start.gameObject.SetActive(true);
- Player.Inst.transform.position = OperateData.startPos;
- return Task.CompletedTask;
- }
- public override Task EndState()
- {
- if (start == null)
- {
- start = GameObject.Instantiate(Resources.Load<GameObject>("Prefabs/TeleportPoint"));
- }
- start.gameObject.SetActive(false);
- Player.Inst.transform.position = OperateData.endPos;
- Player.Inst.transform.rotation = Quaternion.Euler(OperateData.endRot);
- return Task.CompletedTask;
- }
- public override void Dispose()
- {
- if (start != null)
- {
- GameObject.Destroy(start);
- }
- base.Dispose();
- if (Voice != null)
- {
- if (!Voice.IsDisposed)
- VoiceManager.Instance.Stop(Voice);
- Voice = null;
- }
- }
- public override void Update() { }
- }
- public class JumpToData
- {
-
- public Vector3 startPos;
-
- public Vector3 endPos;
-
- public Vector3 startRot;
-
- public Vector3 endRot;
-
- public string startName;
-
- public string endName;
-
- public string audioName;
- }
- }
|