示例#1
0
    public void ProcessTurn()
    {
        //We attack the unit until it is killed evenif it means chasing it accross the map.
        if (m_targetObj != null && m_targetObj.tag == "CombatUnit")
        {
            Unit targetUnit = m_targetObj.GetComponent <Unit>();
            Tile targetTile = targetUnit.GetCurrentTile();

            m_unit.SetPath(m_playerAI.m_mapGrid.CreatePath(m_unit.GetCurrentTile(), targetTile, m_unit), targetTile);

            m_targetTile = targetTile;
        }
        else
        {
            switch (m_playerAI.GetUnitTactic())
            {
            case UnitTactic.Attack:
                AttackCity();
                break;

            case UnitTactic.Defend:
                DefendCity();
                break;

            case UnitTactic.None:
                //We defend a city even if we do not have a tactic as there is nothing else to do.
                DefendCity();
                break;

            default:
                break;
            }
        }
    }