/// <summary> /// 子对象销毁时(常用于重用子对象) /// </summary> /// <param name="command">Command.</param> protected virtual void OnChildDestroy(CommandBase command) { command.OnDestroy(); }
public override void AddSubCommand(CommandBase command) { command.Parent = this; _children.Add(command); }
/// <summary> /// 当前子对象执行完成 /// </summary> /// <param name="command">Command.</param> public virtual void OnChildDone(CommandBase command) { On_ChildDoneCallback(command); OnChildDestroy(command); }
public virtual void OnChildStart(CommandBase command) { On_ChildExecuteCallback(command); }
public virtual void AddSubCommand(CommandBase command) { }
public void AddConditionWork(CommandBase selectWork, CommandBase succeedWork, CommandBase failWork) { _selectWork = selectWork; _succeedWork = succeedWork; _failWork = failWork; _selectWork.Parent = this; if (_succeedWork != null) { _succeedWork.Parent = this; } if (_failWork != null) { _failWork.Parent = this; } }
/// <summary> /// 添加子命令,如果不在执行中,调用Execute执行当前添加的子命令,如果在执行中,添加到队列中 /// </summary> /// <param name="command">Command.</param> public override void AddSubCommand(CommandBase command) { base.AddSubCommand(command); Execute(); }