private void addUnit(UnitType unitType, Character character, int x, int y, Faction faction)
        {
            int        index     = (int)(unitType);
            GameObject newUnitGO = Instantiate(
                unitPrefabs[index],
                Util.GridToWorld(x, y, battlefield.map[x, y].Count + 1),
                unitPrefabs[index].gameObject.transform.rotation);

            Unit newUnit = newUnitGO.GetComponent <Unit>();

            newUnit.setFaction(faction);
            battlefield.addUnit(newUnit, character, x, y);
        }
Exemple #2
0
        private void addUnit(UnitType unitType, Character character, int x, int y, Faction faction)
        {
            int index = (int)(unitType);

            //hack demo is in 15 hours i'm so tired let me sleep
            Vector3 offset = new Vector3(0, -2.2f, 0);

            if (unitType == UnitType.LightHorse || unitType == UnitType.HeavyHorse)
            {
                offset += new Vector3(0, -0.8f, 0);
            }

            GameObject newUnitGO = Instantiate(
                unitPrefabs[index],
                Util.GridToWorld(x, y, battlefield.map[x, y].Count + 1) + offset,
                unitPrefabs[index].gameObject.transform.rotation);

            Unit newUnit = newUnitGO.GetComponent <Unit>();

            newUnit.setFaction(faction);
            battlefield.addUnit(newUnit, character, x, y);
        }