Пример #1
0
        // Initializes a fleet.
        public Fleet(int owner, int numShips, Planet sourcePlanet, Planet destinationPlanet, int totalTripLength, int turnsRemaining)
        {
            Owner        = owner;
            NumShips     = numShips;
            SourcePlanet = sourcePlanet;
            if (sourcePlanet != null)
            {
                SourcePlanetId = sourcePlanet.PlanetID;
            }
            DestinationPlanet = destinationPlanet;
            TotalTripLength   = totalTripLength;
            TurnsRemaining    = turnsRemaining;
            IsMine            = owner == 1;

            if (destinationPlanet != null)
            {
                DestinationPlanetId = destinationPlanet.PlanetID;
                destinationPlanet.AddArmada(this);
                if (owner != 1 && destinationPlanet.Owner != this.Owner)
                {
                    destinationPlanet.IsUnderAttack = true;
                }
            }
        }