コード例 #1
0
        public void PlanetTravel(double currentPlanetx, double destinationPlanetx, double currentPlanety, double destinationPlanety, Ship ship, PersonalStatus PS, Fuel fuel)
        {
            double distTraveled    = (Math.Sqrt(Math.Pow(currentPlanetx - destinationPlanetx, 2) + Math.Pow(currentPlanety - destinationPlanety, 2)));
            double playerWarpSpeed = (Math.Pow(ship.ShipSpeed, 10 / 3) + Math.Pow(10 - ship.ShipSpeed, -11 / 3));
            double time            = distTraveled / playerWarpSpeed;

            PS.AddTime(time);
            fuel.MyCurrentFuel -= ((int)(distTraveled));
            if (PS.TravelAge() > 40.0)
            {
                GO.Retire(PS, ship);
            }
        }