Ejemplo n.º 1
0
        private GameSession StopShip(GameSession gameSession, ICelestialObject celestialObject, IModule module, EngineSettings settings)
        {
            // TODO: Add property Agility to Spacecraft
            const float SpacecraftAgility = 1;

            double turnSpeed = SpacecraftAgility / (settings.UnitsPerSecond * module.ReloadTime);

            var speedAfterCalculation = celestialObject.Speed - (float)turnSpeed;

            if (celestialObject.Speed < 0)
            {
                speedAfterCalculation = 0;
            }

            celestialObject.SetSpeed(speedAfterCalculation);

            module.Reload();

            return(gameSession);
        }
Ejemplo n.º 2
0
        private GameSession Acceleration(GameSession gameSession, ICelestialObject celestialObject, IModule module, EngineSettings settings)
        {
            // TODO: Add property Agility to Spacecraft
            const float SpacecraftAgility = 1;

            var spacecraft = (Spaceship)celestialObject;

            double turnSpeed = SpacecraftAgility / (settings.UnitsPerSecond * module.ReloadTime);

            var speedAfterCalculation = celestialObject.Speed + (float)turnSpeed;

            if (spacecraft.Speed > spacecraft.MaxSpeed)
            {
                speedAfterCalculation = spacecraft.MaxSpeed;
            }

            celestialObject.SetSpeed(speedAfterCalculation);

            module.Reload();

            return(gameSession);
        }