protected virtual void TryAlternativeMovement() { if (alternativeManeuvers.Count > 0) { MovementStruct maneuver = alternativeManeuvers[0]; alternativeManeuvers.Remove(alternativeManeuvers[0]); if (failedManeuvers.Contains(maneuver)) { TryAlternativeMovement(); } else { GenericMovement newMovementAttempt = ShipMovementScript.MovementFromStruct(maneuver); if (DebugManager.DebugAI) { Debug.Log("Tries: " + newMovementAttempt); } Selection.ThisShip.SetAssignedManeuver(newMovementAttempt); newMovementAttempt.Initialize(); movementPrediction = new MovementPrediction(newMovementAttempt, CheckSwerveAlternativePrediction); } } else { Console.Write("Ship doesn't see alternatives to the asteroid collision", LogTypes.AI, false, "yellow"); Selection.ThisShip.SetAssignedManeuver(originalMovement); Selection.ThisShip.AssignedManeuver.LaunchShipMovement(); } }
protected virtual void TryAlternativeMovement() { if (alternativeManeuvers.Count > 0) { ManeuverHolder maneuver = alternativeManeuvers[0]; maneuver.UpdateColorComplexity(); alternativeManeuvers.Remove(alternativeManeuvers[0]); if (failedManeuvers.Contains(maneuver) || !Selection.ThisShip.HasManeuver(maneuver)) { TryAlternativeMovement(); } else { GenericMovement newMovementAttempt = ShipMovementScript.MovementFromStruct(maneuver); if (DebugManager.DebugAI) { Debug.Log("Tries: " + newMovementAttempt); } Selection.ThisShip.SetAssignedManeuver(newMovementAttempt); newMovementAttempt.Initialize(); //movementPrediction = new MovementPrediction(newMovementAttempt, CheckSwerveAlternativePrediction); } } else { Selection.ThisShip.SetAssignedManeuver(originalMovement); LaunchMovementFinally(); } }