Exemplo n.º 1
0
        internal ThrusterArray(IShip ship)
        {
            _ship = ship;

            var forwardThrust = new Vector2(0, -ThrustPower);
            var backthrust = new Vector2(0, ThrustPower);

            var leftOfShip = new Vector2(-ship.Radius, 0);
            var rightOfShip = new Vector2(ship.Radius, 0);

            _frontLeftThruster = new Thruster(leftOfShip, forwardThrust, ThrustEnergyCost);
            _frontRightThruster = new Thruster(rightOfShip, forwardThrust, ThrustEnergyCost);
            _backLeftThruster = new Thruster(leftOfShip, backthrust, ThrustEnergyCost);
            _backRightThruster = new Thruster(rightOfShip, backthrust, ThrustEnergyCost);
        }
Exemplo n.º 2
0
 private void ApplyForce(Thruster thruster, float energyScalingFactor)
 {
     var force = thruster.Engage(energyScalingFactor);
     if (force.Vector.Length() > 0)
     {
         _ship.ApplyInternalForce(force);
     }
 }
Exemplo n.º 3
0
        public void Setup()
        {
            _position = new Vector2(1, 1);
            _direction = new Vector2(0, -1);

            _thruster = new Thruster(_position, _direction, 0.1f);
        }
Exemplo n.º 4
0
 public void Thruster_maxEnergyDraw_cannot_be_zero()
 {
     var exception = Assert.Throws<ArgumentException>(() => _thruster = new Thruster(_position, _direction, 0f));
     Assert.AreEqual("Must be positive and non-zero.\r\nParameter name: maxEnergyDraw", exception.Message);
 }