void Detect() { if (wcTurrets != null) { threatsTemp.Clear(); wcTurrets.GetSortedThreats(Me, threatsTemp); if (threatsTemp.Count > 0) { SetEnemy(threatsTemp.Keys.First()); return; } } else if (turrets.Count == 0) { thrust.Reset(); gyros.Reset(); throw new Exception("No turrets remain for detection."); } foreach (IMyLargeTurretBase t in turrets) { if (t.HasTarget) { SetEnemy(t.GetTargetedEntity()); return; } } detected = false; }
void Stop() { if (recordingPath != null) { recordingPath.UpdateStatus(Path.Mode.None); recordingPath = null; } if (currentPaths.Count > 0) { Path current = paths [currentPaths.Peek()]; current.UpdateStatus(Path.Mode.None); currentPaths.Clear(); } thrust.Reset(); gyros.Reset(); }
// Utility public void Reset(bool gyroOverride = false, bool?thrusterEnable = true, Func <IMyThrust, bool> thrusterCondition = null) { GyroControl.Reset(); GyroControl.EnableOverride(gyroOverride); ThrustControl.Reset(thrusterCondition); if (thrusterEnable != null) { ThrustControl.Enable((bool)thrusterEnable, thrusterCondition); } }
void ResetMovement() { gyros.Reset(); thrust.Reset(); }