AddTransport() public method

public AddTransport ( Race race, int amount ) : void
race Beyond_Beyaan.Data_Modules.Race
amount int
return void
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 2
0
        public void SplitFleet(Empire empire)
        {
            Fleet fleet = new Fleet();

            fleet.Empire         = FleetToSplit.Empire;
            fleet.GalaxyX        = FleetToSplit.GalaxyX;
            fleet.GalaxyY        = FleetToSplit.GalaxyY;
            fleet.AdjacentSystem = FleetToSplit.AdjacentSystem;

            foreach (KeyValuePair <Ship, int> ship in FleetToSplit.Ships)
            {
                if (ship.Value > 0)
                {
                    SelectedFleet.SubtractShips(ship.Key, ship.Value);
                    fleet.AddShips(ship.Key, ship.Value);
                }
            }
            foreach (var transport in FleetToSplit.TransportShips)
            {
                if (transport.amount > 0)
                {
                    SelectedFleet.SubtractTransport(transport.raceOnShip, transport.amount);
                    fleet.AddTransport(transport.raceOnShip, transport.amount);
                }
            }
            SelectedFleet.ClearEmptyShips();
            fleet.ClearEmptyShips();
            fleet.TravelNodes = FleetToSplit.TravelNodes;
            if (SelectedFleet.Ships.Count == 0 && SelectedFleet.TransportShips.Count == 0)
            {
                Fleets.Remove(SelectedFleet);
                empire.FleetManager.RemoveFleet(SelectedFleet);
            }
            if (fleet.Ships.Count > 0 || fleet.TransportShips.Count > 0)
            {
                Fleets.Add(fleet);
                empire.FleetManager.AddFleet(fleet);
            }
            SelectedFleet = fleet;
        }
Ejemplo n.º 3
0
        public void SplitFleet(Empire empire)
        {
            Fleet fleet = new Fleet();
            fleet.Empire = FleetToSplit.Empire;
            fleet.GalaxyX = FleetToSplit.GalaxyX;
            fleet.GalaxyY = FleetToSplit.GalaxyY;
            fleet.AdjacentSystem = FleetToSplit.AdjacentSystem;

            foreach (KeyValuePair<Ship, int> ship in FleetToSplit.Ships)
            {
                if (ship.Value > 0)
                {
                    SelectedFleet.SubtractShips(ship.Key, ship.Value);
                    fleet.AddShips(ship.Key, ship.Value);
                }
            }
            foreach (var transport in FleetToSplit.TransportShips)
            {
                if (transport.amount > 0)
                {
                    SelectedFleet.SubtractTransport(transport.raceOnShip, transport.amount);
                    fleet.AddTransport(transport.raceOnShip, transport.amount);
                }
            }
            SelectedFleet.ClearEmptyShips();
            fleet.ClearEmptyShips();
            fleet.TravelNodes = FleetToSplit.TravelNodes;
            if (SelectedFleet.Ships.Count == 0 && SelectedFleet.TransportShips.Count == 0)
            {
                Fleets.Remove(SelectedFleet);
                empire.FleetManager.RemoveFleet(SelectedFleet);
            }
            if (fleet.Ships.Count > 0 || fleet.TransportShips.Count > 0)
            {
                Fleets.Add(fleet);
                empire.FleetManager.AddFleet(fleet);
            }
            SelectedFleet = fleet;
        }
Ejemplo n.º 4
0
        public void SelectFleet(int whichFleet)
        {
            if (whichFleet < Fleets.Count)
            {
                SelectedFleet = Fleets[whichFleet];

                FleetToSplit = new Fleet();
                FleetToSplit.Empire = SelectedFleet.Empire;
                FleetToSplit.TravelNodes = SelectedFleet.TravelNodes;
                FleetToSplit.TentativeNodes = SelectedFleet.TentativeNodes;
                FleetToSplit.AdjacentSystem = SelectedFleet.AdjacentSystem;
                FleetToSplit.GalaxyX = SelectedFleet.GalaxyX;
                FleetToSplit.GalaxyY = SelectedFleet.GalaxyY;
                foreach (KeyValuePair<Ship, int> ship in SelectedFleet.Ships)
                {
                    FleetToSplit.AddShips(ship.Key, ship.Value);
                }
                foreach (var transport in SelectedFleet.TransportShips)
                {
                    FleetToSplit.AddTransport(transport.raceOnShip, transport.amount);
                }
            }
        }
Ejemplo n.º 5
0
        public void SelectFleet(int whichFleet)
        {
            if (whichFleet < Fleets.Count)
            {
                SelectedFleet = Fleets[whichFleet];

                FleetToSplit                = new Fleet();
                FleetToSplit.Empire         = SelectedFleet.Empire;
                FleetToSplit.TravelNodes    = SelectedFleet.TravelNodes;
                FleetToSplit.TentativeNodes = SelectedFleet.TentativeNodes;
                FleetToSplit.AdjacentSystem = SelectedFleet.AdjacentSystem;
                FleetToSplit.GalaxyX        = SelectedFleet.GalaxyX;
                FleetToSplit.GalaxyY        = SelectedFleet.GalaxyY;
                foreach (KeyValuePair <Ship, int> ship in SelectedFleet.Ships)
                {
                    FleetToSplit.AddShips(ship.Key, ship.Value);
                }
                foreach (var transport in SelectedFleet.TransportShips)
                {
                    FleetToSplit.AddTransport(transport.raceOnShip, transport.amount);
                }
            }
        }
Ejemplo n.º 6
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);
         }
     }
 }