private void CloseThruster(BaseClosableClass thruster) { thruster.OnClose -= CloseThruster; ControllableThruster closedThruster = (ControllableThruster)thruster; _thrusters[closedThruster.ThrustDirection].Remove(closedThruster); RecalculateMaxEffectiveThrust(); }
public void AddNewThruster(MyThrust myThrust) { if (myThrust == null || _thisIController == null) { return; } ControllableThruster thruster = null; if (_thisIController.WorldMatrix.Forward * -1 == myThrust.WorldMatrix.Forward) { thruster = new ControllableThruster(myThrust, ThrustDirection.Forward); } if (_thisIController.WorldMatrix.Backward * -1 == myThrust.WorldMatrix.Forward) { thruster = new ControllableThruster(myThrust, ThrustDirection.Back); } if (_thisIController.WorldMatrix.Left * -1 == myThrust.WorldMatrix.Forward) { thruster = new ControllableThruster(myThrust, ThrustDirection.Left); } if (_thisIController.WorldMatrix.Right * -1 == myThrust.WorldMatrix.Forward) { thruster = new ControllableThruster(myThrust, ThrustDirection.Right); } if (_thisIController.WorldMatrix.Up * -1 == myThrust.WorldMatrix.Forward) { thruster = new ControllableThruster(myThrust, ThrustDirection.Up); } if (_thisIController.WorldMatrix.Down * -1 == myThrust.WorldMatrix.Forward) { thruster = new ControllableThruster(myThrust, ThrustDirection.Down); } if (thruster == null) { return; } thruster.OnClose += CloseThruster; _thrusters[thruster.ThrustDirection].Add(thruster); RecalculateMaxEffectiveThrust(); }