private bool IsBoostTemplateColliderDataAllowed(ObstaclesStayDetectorForced collider) { if (!TheShip.IsIgnoreObstacles && !TheShip.IsIgnoreObstaclesDuringBarrelRoll && !IsTractorBeamBarrelRoll && collider.OverlapsAsteroidNow) { BarrelRollProblems.Add(ActionFailReason.ObstacleHit); } else if (collider.OffTheBoardNow) { BarrelRollProblems.Add(ActionFailReason.OffTheBoard); } return(BarrelRollProblems.Count == 0); }
protected IEnumerator CheckCollisionsOfTemporaryBoostElements(Action callback) { BarrelRollProblems.Clear(); ObstaclesStayDetectorForced obstaclesStayDetectorMovementTemplate = TheShip.GetBoosterHelper().Find(SelectedBoostHelper).GetComponentInChildren <ObstaclesStayDetectorForced>(); obstaclesStayDetectorMovementTemplate.TheShip = TheShip; TemporaryShipBase.transform.Find("ShipBase").Find("ObstaclesStayDetector").gameObject.AddComponent <ObstaclesStayDetectorForced>(); ObstaclesStayDetectorForced obstaclesStayDetectorNewBase = TemporaryShipBase.GetComponentInChildren <ObstaclesStayDetectorForced>(); yield return(CheckBoostTemplate(obstaclesStayDetectorMovementTemplate)); yield return(CheckBoostTemplate(obstaclesStayDetectorNewBase)); if (!IsBoostTemplateColliderDataAllowed(obstaclesStayDetectorMovementTemplate) || !IsBoostTemplateNewBaseDataAllowed(obstaclesStayDetectorNewBase)) { CancelBoost(); } else { callback(); } }