public void ImportFromLevel(DataMission mission)
    {
        this.mission = mission;

        extraTeamCount = mission.teamsId.Length;
        enemyTeams     = new InstanceTeam[extraTeamCount];
        friendTeams    = new InstanceTeam[extraTeamCount];

        for (int teamIndex = 0; teamIndex < extraTeamCount; ++teamIndex)
        {
            int teamId = mission.teamsId[teamIndex];
            if (teamId != 0)
            {
                int   memberCount = mission.GetMemberCount(teamIndex);
                int[] unitsId     = mission.GetUnitsId(teamIndex);
                int[] unitsCount  = mission.GetUnitsCount(teamIndex);

                InstanceTeam instanceTeam = new InstanceTeam();

                for (int i = 0; i < memberCount; ++i)
                {
                    int   unitId     = unitsId[i];
                    int   unitCount  = unitsCount[i];
                    int   heroId     = 0;
                    float powerScale = mission.powerScale;

                    if (unitId > 0 && unitCount > 0)
                    {
                        InstanceUnit instanceUnit = new InstanceUnit(false, heroId, unitId, unitCount, powerScale);
                        instanceTeam.units[i] = instanceUnit;
                        instanceUnit.Init();
                    }
                }

                if (teamId > 0)
                {
                    enemyTeams[teamIndex] = instanceTeam;
                }
                else
                {
                    friendTeams[teamIndex] = instanceTeam;
                }
            }
        }
    }
    public void ImportFromPlayer()
    {
        InstancePlayerArmy playerArmy = InstancePlayer.instance.playerArmy;

        InstanceTeam instanceTeam = new InstanceTeam();

        for (int i = 0; i < playerArmy.memberCount; ++i)
        {
            int   unitId     = playerArmy.unitId[i];
            int   unitCount  = playerArmy.unitCount[i];
            int   heroId     = playerArmy.heroId [i];
            float powerScale = 1;

            if (unitId > 0 && unitCount > 0)
            {
                InstanceUnit instanceUnit = new InstanceUnit(true, heroId, unitId, unitCount, powerScale);
                instanceTeam.units[i] = instanceUnit;
                instanceUnit.Init();
            }
        }

        myTeam = instanceTeam;
    }