using System; using System.Collections.Generic; using Mono.Event; using Sirenix.OdinInspector; using UnityEngine; using UnityEngine.Playables; namespace UnityTest.ZXL { public abstract class ProcessBase : SerializedMonoBehaviour { public ProcessType processType; public List playableDirectors = new List(); #if UNITY_EDITOR [Button] void Add(GameObject go) { var list = go.GetComponentAllChild(); playableDirectors = new List(list); } #endif protected virtual void OnInit() { EventManager.Instance.Subscribe(ConstEventArgs.EventId, ConstEventLogic); EventManager.Instance.Subscribe(ClickObjectEventArgs.EventId, ClickObjectEvent); EventManager.Instance.Subscribe(PlayableStoppedEventArgs.EventId, PlayableStoppedEvent); } protected virtual void OnUpdate() { } protected virtual void OnLevel() { EventManager.Instance.Unsubscribe(ConstEventArgs.EventId, ConstEventLogic); EventManager.Instance.Unsubscribe(ClickObjectEventArgs.EventId, ClickObjectEvent); EventManager.Instance.Unsubscribe(PlayableStoppedEventArgs.EventId, PlayableStoppedEvent); } public virtual void ConstEventLogic(object sender, GameEventArgs e) { var args = e as ConstEventArgs; } public virtual void PlayableStoppedEvent(object sender, GameEventArgs e) { var args = e as PlayableStoppedEventArgs; } public virtual void ClickObjectEvent(object sender, GameEventArgs e) { var args = e as ClickObjectEventArgs; } private void Awake() { OnInit(); } private void Update() { OnUpdate(); } private void OnDestroy() { OnLevel(); } } public enum ProcessType { 一_爆炸发生场景, 二_汇报程序, 三_准备场景, 四_现场处置场景, } }