Esempio n. 1
0
        private SteerableDirection Build()
        {
            var steerableDirection = new SteerableDirection(_forward);

            steerableDirection.DegreesPerSecond(_degreesPerSecond);
            return(steerableDirection);
        }
Esempio n. 2
0
 public Ship(Vector3 position, Vector3 heading)
 {
     _position     = position;
     HalfSizeX     = 0.03f;
     HalfSizeY     = 0.03f;
     _turnSpeed    = 270f;
     _fireCooldown = new Cooldown(0.35f);
     _heading      = new SteerableDirection(heading);
     _thruster     = new InertialThruster(_heading, 0.2f, 0.1f, 8f);
 }
Esempio n. 3
0
        public void _turning_180_degrees_updates_forward_180_degrees()
        {
            SteerableDirection steerableDirection = A.SteerableDirection.WithDegreesPerSecond(180f);

            Assert.AreEqual(Vector3.up, steerableDirection.Forward);

            TestableTime.AdvanceSeconds(1f - TestableTime.deltaTime);
            steerableDirection.Tick();

            var result  = steerableDirection.Forward;
            var resultX = result.x;
            var resultY = result.y;

            Assert.AreEqual(Vector3.down.x, resultX, RotationTolerance);
            Assert.AreEqual(Vector3.down.y, resultY, RotationTolerance);
        }
Esempio n. 4
0
 public InertialThruster(SteerableDirection heading, float dampenVelocityRate, float thrustRate, float maxThrust)
 {
     _floatAccelerator   = new FloatAccelerator(thrustRate, maxThrust);
     _dampenVelocityRate = dampenVelocityRate;
     _heading            = heading;
 }