Ejemplo n.º 1
0
        public override void Update(ShipControlState controlState, float elapsedTime)
        {
            base.Update(controlState, elapsedTime);

            if (controlState.TryingToShoot(this.controlGroup))
            {
                if (this.game.TimeF > this.dontFireUntil)
                {
                    this.shoot();
                }
            }
        }
Ejemplo n.º 2
0
        private void updateMovement(ShipControlState controlState, float elapsedTime)
        {
            this.forwards += Angle.FromRadians(controlState.Steer) * elapsedTime;

            if (controlState.Accelerate)
            {
                this.velocity += this.forwards.Vector * this.acceleration * elapsedTime;
            }

            var dragFactor = Mathf.Pow(this.inverseFriction, elapsedTime);

            this.velocity *= dragFactor;

            this.position += this.velocity * elapsedTime;

            this.localRotation = Matrix2.CreateRotation(-this.forwards.Radians);
        }
Ejemplo n.º 3
0
 private void updateEquipment(ShipControlState controlState, float elapsedTime)
 {
     foreach (var e in this.equipment)
     {
         e.Update(controlState, elapsedTime);
     }
 }
Ejemplo n.º 4
0
 public virtual void Update(ShipControlState controlState, float elapsedTime)
 {
     this.realPosition = this.owner.LocalToGlobalPosition(this.positionOffset);
     this.realDirection = this.owner.LocalToGlobalDirection(this.directionOffset);
 }