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

        ActorCommand actorCommand = command as ActorCommand;

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