void UpDateFleets(MapGlobal MapGlobal, int Index, List <FightShip> fleet) { bool b = false; b = (ClearDead(fleet) != null); if (b) { List <FightShip> clearFleet = ClearDead(fleet); MapGlobal.MapShip[] tempFleet = new MapGlobal.MapShip[clearFleet.Count]; for (int i = 0; i < clearFleet.Count; i++) { tempFleet[i].attack = clearFleet[i].attack; tempFleet[i].defence = clearFleet[i].defence; tempFleet[i].maxDefence = clearFleet[i].MaxDefence; tempFleet[i].speed = clearFleet[i].speed; tempFleet[i].shipTypeIndex = clearFleet[i].shipTypeIndex; } for (int i = 0; i < MapGlobal.Fleets.Length; i++) { if (MapGlobal.Fleets[i].mapIndex == Index && MapGlobal.Fleets[i].camp == fleet[0].camp) { MapGlobal.Fleets[i].MapShip = tempFleet; } } } else { MapGlobal.Fleet[] tempFleets = new MapGlobal.Fleet[MapGlobal.Fleets.Length - 1]; for (int i = 0, j = 0; i < MapGlobal.Fleets.Length; i++) { if (MapGlobal.Fleets[i].mapIndex != Index) { tempFleets[j] = MapGlobal.Fleets[i]; j++; } } MapGlobal.Fleets = tempFleets; MapGlobal.unitCount = MapGlobal.Fleets.Length; } }
void NewFleet(int index, int camp, MapGlobal MapGlobal) { for (int i = 0; i < MapGlobal.Fleets.Length; i++) { if (MapGlobal.Fleets[i].mapIndex == index) { if (MapGlobal.Fleets[i].camp == 0) { MapGlobal.MapShip[] tempMapShip = new MapGlobal.MapShip[weFleet.Count]; for (int j = 0; j < tempMapShip.Length; j++) { tempMapShip[j].attack = weFleet[j].attack; tempMapShip[j].defence = weFleet[j].defence; tempMapShip[j].maxDefence = weFleet[j].MaxDefence; tempMapShip[j].speed = weFleet[j].speed; tempMapShip[j].shipTypeIndex = weFleet[j].shipTypeIndex; } MapGlobal.Fleets[i].MapShip = tempMapShip; } } } }