public void Reset() { m_StateStack.Clear(); while (m_CommandQueue.Count > 0) { IAiCommand cmd = m_CommandQueue.Dequeue(); cmd.Recycle(); } }
public void Execute() { _command = _model.Command; _command.End -= OnCommandFinish; _command.End += OnCommandFinish; _command.Init(_player, _self); _command.Execute(_move); }
public SmartZombieModel(EnemyType type, IAiCommand command, EnemyRecord record) { EnemyType = type; Health = record.Health; Armor = record.Armor; Speed = record.Speed; Damage = record.Damage; Cooldown = record.Cooldown; Command = command; }
public static AbstractEnemyModel GetEnemyModel(EnemyType type, IAiCommand command) { var record = ScriptableUtils.GetEnemyRecord(type); switch (type) { case EnemyType.Skeleton: return(new SmartZombieModel(type, command, record)); case EnemyType.Zombie: return(new ZombieModel(type, command, record)); } return(null); }
private void ExecuteCommandQueue(UserInfo user, long deltaTime) { UserAiStateInfo userAi = user.GetAiStateInfo(); while (userAi.CommandQueue.Count > 0) { IAiCommand cmd = userAi.CommandQueue.Peek(); if (cmd.Execute(deltaTime)) { userAi.CommandQueue.Dequeue(); } else { break; } } }
private void ExecuteCommandQueue(NpcInfo npc, long deltaTime) { NpcAiStateInfo npcAi = npc.GetAiStateInfo(); while (npcAi.CommandQueue.Count > 0) { IAiCommand cmd = npcAi.CommandQueue.Peek(); if (cmd.Execute(deltaTime)) { npcAi.CommandQueue.Dequeue(); } else { break; } } }