/// <summary> /// 设置信号 /// </summary> /// <param name="signal"></param> /// <param name="handle"></param> /// <returns></returns> public ActionSequence SetHandleSignal(bool signal, ActionSequenceHandle handle = null) { if (handle != null) { this.handle = handle; } nodes.Add(ActionNodeSetSignal.Get(signal)); return(this); }
internal ActionSequence SetHandle(ActionSequenceHandle handle) { //可能有人控制这个Sequence,将会丢弃前任,启用新人 if (this.handle != null) { Debug.LogWarning("try set handle, but this sequence is already controlled by a handle! Original handle lose control of this sequence and input handle take control."); this.handle.sequence = null; } //可能句柄还在控制其他Sequence,丢失上一个Sequence的控制权,控制当前的Sequence if (handle.sequence != null) { //Debug.LogWarning("try set handle, but the input handle already controls a sequence! Lose control of the original sequence and take control this sequence"); handle.sequence.handle = null; } //设置句柄 this.handle = handle; handle.sequence = this; return(this); }
/// <summary> /// 循环调用函数,循环次数作为参数,并设置次数,是否立即开始 /// </summary> /// <param name="id"></param> /// <param name="handle">控制句柄</param> /// <param name="interval">延迟</param> /// <param name="loopTime">循环调用次数</param> /// <param name="isActionAtStart">是否立即开始</param> /// <param name="action">调用的函数,循环次数作为参数</param> /// <returns></returns> public static ActionSequence LooperUnscaled(this Component id, ActionSequenceHandle handle, float interval, int loopTime, bool isActionAtStart, Action <int> action) { return(LooperUnscaled(id, interval, loopTime, isActionAtStart, action).SetHandle(handle)); }
/// <summary> /// 无限循环调用函数 /// </summary> /// <param name="id"></param> /// <param name="handle">控制句柄</param> /// <param name="interval">延迟</param> /// <param name="action">调用的函数,循环次数作为参数</param> /// <returns></returns> public static ActionSequence LooperUnscaled(this Component id, ActionSequenceHandle handle, float interval, Action <int> action) { return(LooperUnscaled(id, interval, action).SetHandle(handle)); }
/// <summary> /// 延迟调用函数 /// </summary> /// <param name="id"></param> /// <param name="handle">控制句柄</param> /// <param name="delay">延迟</param> /// <param name="action">调用的函数</param> /// <returns></returns> public static ActionSequence DelayerUnscaled(this Component id, ActionSequenceHandle handle, float delay, Action action) { return(DelayerUnscaled(id, delay, action).SetHandle(handle)); }
/// <summary> /// 用Component作为ID开序列,并使用“控制句柄” /// </summary> /// <param name="id"></param> /// <param name="handle">控制句柄</param> /// <returns></returns> public static ActionSequence SequenceUnscaled(this Component id, ActionSequenceHandle handle) { return(ActionSequenceSystem.SequenceUnscaled(id).SetHandle(handle)); }
//直接循环动作 public static ActionSequence Infiniter(this Component id, ActionSequenceHandle handle, float interval, Action <int> action) { return(Infiniter(id, interval, action).SetHandle(handle)); }
public static ActionSequence Looper(ActionSequenceHandle handle, float interval, int loopTime, bool isActionAtStart, Action <int> action) { return(Looper(interval, loopTime, isActionAtStart, action).SetHandle(handle)); }
/// <summary> /// 循环调用函数,循环次数作为参数,并设置次数,是否立即开始 /// </summary> /// <param name="id"></param> /// <param name="handle">控制句柄</param> /// <param name="interval">延迟</param> /// <param name="loopTime">循环调用次数</param> /// <param name="isActionAtStart">是否立即开始</param> /// <param name="action">调用的函数,循环次数作为参数</param> /// <returns></returns> public static ActionSequence Looper(this Component id, ActionSequenceHandle handle, float interval, int loopTime, bool isActionAtStart, Action <int> action) => Looper(id, interval, loopTime, isActionAtStart, action).SetHandle(handle);
public static ActionSequence Delayer(ActionSequenceHandle handle, float delay, Action action) { return(Delayer(delay, action).SetHandle(handle)); }
/// <summary> /// 无限循环调用函数 /// </summary> /// <param name="id"></param> /// <param name="handle">控制句柄</param> /// <param name="interval">延迟</param> /// <param name="action">调用的函数,循环次数作为参数</param> /// <returns></returns> public static ActionSequence Looper(this Component id, ActionSequenceHandle handle, float interval, Action <int> action) => Looper(id, interval, action).SetHandle(handle);
/// <summary> /// 延迟调用IAction接口,循环次数作为参数 /// </summary> /// <param name="id"></param> /// <param name="handle">控制句柄</param> /// <param name="interval">延迟</param> /// <param name="action">调用的函数</param> /// <param name="actionId">用于区分多路回调</param> /// <returns></returns> public static ActionSequence Looper(this Component id, ActionSequenceHandle handle, float interval, IAction action, int actionId) => Looper(id, interval, action, actionId).SetHandle(handle);
Delayer(this Component id, ActionSequenceHandle handle, float delay, Action action) => Delayer(id, delay, action).SetHandle(handle);
/// <summary> /// 延迟调用IAction接口 /// </summary> /// <param name="id"></param> /// <param name="handle">控制句柄</param> /// <param name="delay">延迟</param> /// <param name="action">调用的函数</param> /// <param name="actionId">用于区分多路回调</param> /// <returns></returns> public static ActionSequence Delayer(this Component id, ActionSequenceHandle handle, float delay, IAction action, int actionId) => Delayer(id, delay, action, actionId).SetHandle(handle);
/// <summary> /// 用Component作为ID开序列,并使用“控制句柄” /// </summary> /// <param name="id"></param> /// <param name="handle">控制句柄</param> /// <returns></returns> public static ActionSequence Sequence(this Component id, ActionSequenceHandle handle) => ActionSequenceSystem.Sequence(id).SetHandle(handle);