RTSEngine.Data.Team.RTSRace.UpdateActiveUnits C# (CSharp) Method

UpdateActiveUnits() public method

public UpdateActiveUnits ( ) : void
return void
        public void UpdateActiveUnits()
        {
            int c = 0;
            for(int i = 0; i < MAX_UNIT_TYPES; i++) {
                if(Units[i] != null) c++;
            }
            ActiveUnits = new RTSUnitData[c];
            c = 0;
            for(int i = 0; i < MAX_UNIT_TYPES; i++) {
                if(Units[i] != null) ActiveUnits[c++] = Units[i];
            }
        }

Usage Example

Exemplo n.º 1
0
        public static RTSRace Deserialize(BinaryReader s, GameState state)
        {
            RTSRace race = new RTSRace();

            race.FriendlyName = s.ReadString();
            int c = s.ReadInt32();

            for (int i = 0; i < c; i++)
            {
                int ui = s.ReadInt32();
                race.Units[ui] = RTSUnitData.Deserialize(s, state, ui);
            }
            race.UpdateActiveUnits();
            c = s.ReadInt32();
            for (int i = 0; i < c; i++)
            {
                int bi = s.ReadInt32();
                race.Buildings[bi] = RTSBuildingData.Deserialize(s, state, bi);
            }
            race.UpdateActiveBuildings();
            race.SCAction    = state.Scripts[s.ReadString()];
            race.SCMovement  = state.Scripts[s.ReadString()];
            race.SCTargeting = state.Scripts[s.ReadString()];
            return(race);
        }
All Usage Examples Of RTSEngine.Data.Team.RTSRace::UpdateActiveUnits