Ejemplo n.º 1
0
    public static GameObject[][] CreateBattleUnits(InstanceBattle battle, DataMap dataMap)
    {
        int totalGroup = 1 + battle.extraTeamCount;

        GameObject[][] objects = new GameObject[totalGroup][];

        GameObject[] myObjects = CreateBattleTeam(battle.myTeam, DataConfig.TEAM.MY, dataMap.startPosition, dataMap.startPosition, battle.mission.playerRotation);
        objects [0] = myObjects;

        for (int i = 1; i < totalGroup; ++i)
        {
            int   teamIndex = i - 1;
            COORD location  = dataMap.GetExtraPosition(teamIndex);

            InstanceTeam enemyTeam  = battle.enemyTeams[teamIndex];
            InstanceTeam friendTeam = battle.friendTeams[teamIndex];
            Assert.assert(enemyTeam == null || friendTeam == null);

            float teamRotation = battle.mission.teamsRotation[teamIndex];

            GameObject[] members = null;
            if (enemyTeam != null)
            {
                Assert.assert(location != null);
                members = CreateBattleTeam(enemyTeam, DataConfig.TEAM.ENEMY, location, dataMap.startPosition, teamRotation);
            }
            if (friendTeam != null)
            {
                Assert.assert(location != null);
                members = CreateBattleTeam(friendTeam, DataConfig.TEAM.FRIEND, location, dataMap.startPosition, teamRotation);
            }
            objects [i] = members;
        }

        return(objects);
    }