protected void BrakingOff() { LOGGER.Debug("BrakingOff"); foreach (KeyValuePair <IMyThrust, ThrustersFlag> e in thrustersAndFlags) { IMyThrust thrust = e.Key; ThrustersFlag flag = e.Value; if ((flag & ThrustersFlag.Braking) != 0) { thrust.ThrustOverridePercentage = 0.00001f; } else { thrust.ThrustOverridePercentage = 0f; } } }
protected void GetThrusterOrientation(List <IMyThrust> allThrusters) { Vector3D vectBrakingDir = VectorUtils.GetDirection(referenceBlock, brakingDir); Vector3D vectAcceleratingDir = VectorUtils.GetDirection(referenceBlock, acceleratingDir); foreach (IMyThrust thisThrust in allThrusters) { var thrustDir = thisThrust.WorldMatrix.Forward; bool isBraking = thrustDir == vectBrakingDir; bool isAccelerating = thrustDir == vectAcceleratingDir; ThrustersFlag flag = ThrustersFlag.All; if (!isBraking) { flag ^= ThrustersFlag.Braking; } if (!isAccelerating) { flag ^= ThrustersFlag.Accelerating; } thrustersAndFlags.Add(thisThrust, flag); } }
protected List <IMyThrust> GetThrusters(ThrustersFlag flag) { return(thrustersAndFlags.Where(e => (e.Value & flag) != 0).Select(e => e.Key).ToList()); }