/// <summary> /// Breaks the orbit. Must be in orbit to be called. /// </summary> private void BreakOrbit() { _currentOrIntendedOrbitSlot.BreakOrbit(this); _currentOrIntendedOrbitSlot = null; _isInOrbit = false; }
private void InitializeShipOrbitSlot() { float innerOrbitRadius = Radius * TempGameValues.KeepoutRadiusMultiplier; float outerOrbitRadius = innerOrbitRadius + TempGameValues.ShipOrbitSlotDepth; ShipOrbitSlot = new ShipOrbitSlot(innerOrbitRadius, outerOrbitRadius, this); }
/// <summary> /// Assesses whether this ship should attempt to assume orbit around the helm's current destination target. /// The helm's autopilot should no longer be engaged as this method should only be called upon arrival. /// </summary> /// <returns><c>true</c> if the ship should initiate the process of assuming orbit.</returns> private bool AssessWhetherToAssumeOrbit() { //D.Log("{0}.AssessWhetherToAssumeOrbit() called.", FullName); D.Assert(!_isInOrbit); D.Assert(!_helm.IsAutoPilotEngaged, "{0}'s autopilot is still engaged.".Inject(FullName)); var objectToOrbit = _helm.DestinationInfo.Target as IShipOrbitable; if (objectToOrbit != null) { var baseCmdObjectToOrbit = objectToOrbit as AUnitBaseCmdModel; if (baseCmdObjectToOrbit != null) { if (Owner.IsEnemyOf(baseCmdObjectToOrbit.Owner)) { return false; } } _currentOrIntendedOrbitSlot = objectToOrbit.ShipOrbitSlot; D.Log("{0} should begin to assume orbit around {1}.", FullName, objectToOrbit.FullName); return true; } return false; }