1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using UnityEngine;
- using UnityEngine.Events;
- using System.Collections;
- public abstract class Move
- {
- #region 变量
- public virtual bool InDestination
- {
- get { return InDestination_; }
- set { InDestination_ = value; }
- }
- public bool InDestination_;
- public UnityAction OnForwardStart;
- public UnityAction OnForwardFinish;
- #endregion
- public abstract bool Do();
- public void Pause()
- {
- ManaAnim.MoveList.Remove(this);
- }
- public void Resume()
- {
- ManaAnim.MoveList.Add(this);
- }
- public void PushEvent(EventType type, UnityAction action)
- {
- if (type == EventType.ForwardStart)
- {
- OnForwardStart = action + OnForwardStart;
- }
- else if (type == EventType.ForwardFinish)
- {
- OnForwardFinish = action + OnForwardFinish;
- }
- }
- public void AddEventOnetime(EventType type, UnityAction action)
- {
- if (type == EventType.ForwardStart)
- {
- action += () =>
- {
- OnForwardStart -= action;
- };
- OnForwardStart += action;
- }
- else if (type == EventType.ForwardFinish)
- {
- action += () =>
- {
- OnForwardFinish -= action;
- };
- OnForwardFinish += action;
- }
- }
- public void PushEventOnetime(EventType type, UnityAction action)
- {
- if (type == EventType.ForwardStart)
- {
- action += () =>
- {
- OnForwardStart -= action;
- };
- OnForwardStart = action + OnForwardStart;
- }
- else if (type == EventType.ForwardFinish)
- {
- action += () =>
- {
- OnForwardFinish -= action;
- };
- OnForwardFinish = action + OnForwardFinish;
- }
- }
- }
|