Example #1
0
    /// <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();
    }