/// <summary> /// This attack coroutine, when initiated, will wait until the previous agent is done performing their action, then it will perform the attack action /// This calls the attack controller, to initate the attack and all it's components (the animation, and any follow up actions, such as applying damage and its animation) /// Once the attack controller returns the attack as complete, this agent ends its turn /// </summary> private IEnumerator Attack() { m_performingAction = true; m_previousAgent = m_turnManager.PreviousAgent(); while (!m_previousAgent.m_actionComplete) { if (m_previousAgent == this) { break; } yield return(null); } m_entityContainer.m_attackController.StartAttack(m_currentAttackIndex); while (!m_entityContainer.m_attackController.m_attackComplete) { yield return(null); } m_actionComplete = true; m_performingAction = false; m_attackCoroutine = null; EndTurn(); }
/// <summary> /// Called when an agent is defeated. As instantly removing it may mess up the queue, it stashes them into another list /// Once the turn is complete, then these agents are removed from the master agent queue /// </summary> public void AgentDefeated(TurnBasedAgent p_defeatedAgent) { int indexOfDeatedAgent = m_allAgents.IndexOf(p_defeatedAgent); if (indexOfDeatedAgent < m_currentAgentIndex) { m_indexAlter++; } m_defeatedAgents.Add(p_defeatedAgent); AIManager.Instance.AIDefeated(); }
public bool CurrentAgent(TurnBasedAgent p_agentRequest) { return(m_allAgents[m_currentAgentIndex] == p_agentRequest); }
/// <summary> /// Called from the dungeon manager, when a new ai has spawned. /// This adds it to the agent queue. /// </summary> public void NewAgent(TurnBasedAgent p_newAgent) { m_allAgents.Add(p_newAgent); }
public virtual void Start() { m_movementController = GetComponent <Entity_MovementController>(); m_turnAgent = GetComponent <TurnBasedAgent>(); }