private void GenerateLinearThrust(ShipActions actions) { var linearTarget = 0f; if (actions.HasFlag(ShipActions.Thrust)) { linearTarget += 1f; } if (actions.HasFlag(ShipActions.ReverseThrust)) { linearTarget -= 1f; } if (linearTarget > 0f) { _frontLeftThruster.Throttle += linearTarget; _frontRightThruster.Throttle += linearTarget; } else if (linearTarget < 0f) { _backLeftThruster.Throttle += 0f - linearTarget; _backRightThruster.Throttle += 0f - linearTarget; } }
private void CalculateTargetAngularVelocity(ShipActions actions) { _angularVelocityTarget = 0; if (actions.HasFlag(ShipActions.TurnLeft)) { _angularVelocityTarget -= RotationSpeed; } if (actions.HasFlag(ShipActions.TurnRight)) { _angularVelocityTarget += RotationSpeed; } }