Beispiel #1
0
    /// <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);
                }
            }
        }
    }
Beispiel #2
0
    public override void Process(Command command)
    {
        base.Process(command);

        ActorCommand actorCommand = command as ActorCommand;

        if (actorCommand != null)
        {
            SetCommand(actorCommand);
        }
    }
Beispiel #3
0
    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;
 }
Beispiel #5
0
 /// <summary>
 /// 压入一个命令到命令队列的末尾 by吴江
 /// </summary>
 /// <param name="_cmd"></param>
 public void PushCommand(ActorCommand _cmd)
 {
     cmdList.Add(_cmd);
 }
Beispiel #6
0
 /// <summary>
 /// 压入一个命令到命令队列的开头 by吴江
 /// </summary>
 /// <param name="_cmd"></param>
 public void InsertCommand(ActorCommand _cmd)
 {
     cmdList.Insert(0, _cmd);
 }
Beispiel #7
0
 public void ExecuteCommand()
 {
     Command.Execute(this);
     Command = null;
 }
Beispiel #8
0
 public void SetCommand(ActorCommand command)
 {
     Command = command;
 }