public IEnumerator SpeedLimitCheck() { Debug.LogWarning("Coroutine Start: Speed Limit Check"); while (!theStationManager.trainHasArrived) { if (KmhSpeed > (int)currentSpeedLimit && !emergencyLock) { theScoreManager.Scoring_SpeedLimit(false); StartCoroutine(SpeedLimitEmergencyBrake()); } yield return(new WaitForSeconds(.5f)); } Debug.LogWarning("Coroutine Stop: Stop Speed Limit Check"); }
void OnTriggerEnter(Collider _other) { if (_other.gameObject.tag == "Train_Car_Front") { if (!tutorial) { if (speedEventType == SpeedEventType.SpeedLimit) { Debug.Log("Current Speed Limit: " + speedEventValue); thePowerControl.SetSpeedLimit(speedEventValue); if (thePowerControl.KmhSpeed <= speedEventValue) { theScoreManager.Scoring_SpeedLimit(true); //theGameMaster.Scoring_UnderSpeedLimit(); } } else if (speedEventType == SpeedEventType.SpeedRecommendation) { Debug.Log("Speed Recommendation: " + speedEventValue); if (thePowerControl.KmhSpeed == speedEventValue) { theScoreManager.Scoring_RecommendedSpeed(); } } } else if (tutorial) { if (speedEventType == SpeedEventType.SpeedLimit) { Debug.Log("Current Speed Limit: " + speedEventValue); thePowerControlTutorial.SetSpeedLimit(speedEventValue); if (thePowerControlTutorial.KmhSpeed <= speedEventValue) { theScoreManagerTutorial.Scoring_SpeedLimit(true); //theGameMaster.Scoring_UnderSpeedLimit(); } } else if (speedEventType == SpeedEventType.SpeedRecommendation) { Debug.Log("Speed Recommendation: " + speedEventValue); if (thePowerControlTutorial.KmhSpeed == speedEventValue) { theScoreManagerTutorial.Scoring_RecommendedSpeed(); } } } } }