/// <summary> /// 执行 by吴江 /// </summary> public void Tick() { if (cmdList.Count == 0) { return; } // ActorCommand curCommand = cmdList[0]; bool finished = curCommand.Exec(actor); if (finished) { if (cmdList.Count > 0) { if (ReferenceEquals(cmdList[0], curCommand)) { cmdList.RemoveAt(0); } else { // Exec完后,命令可能发生改变 by吴江 cmdList.Remove(curCommand); } } } }
public override void Process(Command command) { base.Process(command); ActorCommand actorCommand = command as ActorCommand; if (actorCommand != null) { SetCommand(actorCommand); } }
protected override void OnValidate() { base.OnValidate(); if (TaskProvider != null) { TaskProvider = TaskProvider.ScriptClone(); } if (Task != null) { Task = Task.ScriptClone(); } if (Command != null) { Command = Command.ScriptClone(); } }
public ActorController(ActorQuery query, ActorCommand command) { _query = query; _command = command; }
/// <summary> /// 压入一个命令到命令队列的末尾 by吴江 /// </summary> /// <param name="_cmd"></param> public void PushCommand(ActorCommand _cmd) { cmdList.Add(_cmd); }
/// <summary> /// 压入一个命令到命令队列的开头 by吴江 /// </summary> /// <param name="_cmd"></param> public void InsertCommand(ActorCommand _cmd) { cmdList.Insert(0, _cmd); }
public void ExecuteCommand() { Command.Execute(this); Command = null; }
public void SetCommand(ActorCommand command) { Command = command; }