public void ReloadSetMap(ref Map.Map map) { mMap = map; mUnitMap = new UnitMap((int)map.GetMeasurements().X, (int)map.GetMeasurements().Y); mSelectedGroup = new FlockingGroup(ref mDirector, ref mMap); foreach (var funit in mFriendlyMilitary) { mUnitMap.AddUnit(funit); } //This list includes every platform foreach (var platform in mReconstructionList) { mUnitMap.AddUnit(platform); } foreach (var hunit in mHostileMilitary) { mUnitMap.AddUnit(hunit); } }
/// <summary> /// Adds a new platform to the military manager. This also adds it to the UnitMap. /// </summary> /// <param name="platform">Any type of platform which can be damaged (i.e. all platforms)</param> internal void AddPlatform(PlatformBlank platform) { var defensePlatform = platform as DefenseBase; var position = mUnitMap.VectorToTilePos(platform.AbsolutePosition); // Figure out if it is a defense platform. If yes, then figure out its allegiance then // add it to the appropriate list. if (defensePlatform != null) { if (platform.Friendly) { mFriendlyDefensePlatforms.Add(defensePlatform); } else { mHostileDefensePlatforms.Add(defensePlatform); } } // Then add it to the unitMap and the reconstructionlist. mReconstructionList.Add(platform); mUnitMap.AddUnit(platform, position); }