Beyond_Beyaan.Fleet.AddTransport C# (CSharp) Метод

AddTransport() публичный Метод

public AddTransport ( Race race, int amount ) : void
race Beyond_Beyaan.Data_Modules.Race
amount int
Результат void
        public void AddTransport(Race race, int amount)
        {
            bool added = false;
            foreach (TransportShip transport in _transportShips)
            {
                if (transport.raceOnShip == race)
                {
                    transport.amount += amount;
                    added = true;
                    break;
                }
            }
            if (!added)
            {
                TransportShip transport = new TransportShip();
                transport.raceOnShip = race;
                transport.amount = amount;
                _transportShips.Add(transport);
            }
            _maxSpeed = 1;
        }

Usage Example

Пример #1
0
 public void LaunchTransports()
 {
     foreach (var planet in PlanetManager.Planets)
     {
         if (planet.TransferSystem.Key.StarSystem != null)
         {
             Fleet newFleet = new Fleet();
             newFleet.Empire  = this;
             newFleet.GalaxyX = planet.System.X;
             newFleet.GalaxyY = planet.System.Y;
             newFleet.AddTransport(planet.Races[0], planet.TransferSystem.Value);
             newFleet.TravelNodes = new List <TravelNode> {
                 planet.TransferSystem.Key
             };
             planet.RemoveRacePopulation(planet.Races[0], planet.TransferSystem.Value);
             planet.TransferSystem = new KeyValuePair <TravelNode, int>(new TravelNode(), 0);
             newFleet.ResetMove();
             FleetManager.AddFleet(newFleet);
         }
     }
 }
All Usage Examples Of Beyond_Beyaan.Fleet::AddTransport