public virtual bool UpdateEntity(GameTime time) { base.Position = WorldConversions.ConvertFromWorld(entityBody.Position); base.Rotation = entityBody.Rotation; // Reset the velocity damping if (Velocity < MaxLinearVelocity) { Body.LinearDamping = 0; } return(true); }
/// <summary> /// Deaccelerate the ship /// </summary> /// <param name="amount">1.0 is maximun engine thrust, 0.0 is minimum</param> /// <returns>false if max speed limit achieved</returns> public virtual bool Deaccelerate(float amount = 1.0f) { amount = MathHelper.Clamp(amount, -1.0f, 1.0f); bool result = false; if (FrontThruster != null) { result = Thrust(FrontThruster, amount); if (FrontThruster.Effect != null) { Vector2 posLocal = Body.GetWorldPoint( new Vector2(0, -WorldConversions.ConvertFromPixels(Texture.Height / 2))); FrontThruster.Effect.Position = WorldConversions.ConvertFromWorld(posLocal); FrontThruster.Effect.Rotation = Rotation; if (amount != 0) { FrontThruster.Effect.Generate(10); } } } return(result); }