Beispiel #1
0
 internal Unit AddUnit(UnitStats.UnitType unitType, HexCell cell)
 {
     return(unitManager.AddUnitInCell(cell, unitType));
 }
    public GameObject GetSelectedUnit(string unitName, int side)
    {
        GameObject unit = null;

        UnitStats.UnitType unitType = unitType = UnitStats.UnitType.Collector;

        switch (unitName)
        {
        case "Collector":
            unitType = UnitStats.UnitType.Collector;
            break;

        case "Melee":
            unitType = UnitStats.UnitType.SwordMaster;
            break;

        case "Ranged":
            unitType = UnitStats.UnitType.Archer;
            break;

        case "Spellcaster":
            unitType = UnitStats.UnitType.Spellcaster;
            break;

        case "Special":
            unitType = UnitStats.UnitType.SpecialUnit;
            break;
        }


        if (side == 0)
        {
            for (int i = 0; i < m_UnitPoolPlayer.Count; i++)
            {
                if (m_UnitPoolPlayer[i].GetUnitType() == unitType)
                {
                    if (!m_UnitPoolPlayer[i].gameObject.activeInHierarchy)
                    {
                        unit = m_UnitPoolPlayer[i].gameObject;
                        //Set unit side to attack
                    }
                }
            }
        }
        else if (side == 1)
        {
            for (int i = 0; i < m_UnitPoolAI.Count; i++)
            {
                if (m_UnitPoolAI[i].GetUnitType() == unitType)
                {
                    if (!m_UnitPoolAI[i].gameObject.activeInHierarchy)
                    {
                        unit = m_UnitPoolAI[i].gameObject;
                        //Set unit side to attack
                    }
                }
            }
        }

        return(unit);
    }