Esempio n. 1
0
    void Start()
    {
        theStationManager = StationManagerTutorial.S_StationManager;
        theScoreManager = ScoreManagerTutorial.S_ScoreManager;
        thePowerControl = PowerControlTutorial.S_PowerControl;
        theUIManager = UIManagerTutorial.S_UIManager;

        thePowerControl.TogglePowerLock(true);
        theStationManager.StationUpdate();
        thePowerControl.SetSpeedLimit(initialSpeedLimit);

        StartGameSection();
    }
Esempio n. 2
0
    IEnumerator StartGameSectionCoroutine()
    {
        Debug.LogWarning("Coroutine Start: Start Game Section");

        CreateEvenPoints();
        theStationManager.SetupNextStation();
        SpawnPlayerTrainSet(theStationManager.currentStation, numberOfCar);
        distanceToNextStation = GetDistanceOnSpline(
            carFrontNose.transform.position + Vector3.up * currentTrainSet.noseToSplineYAxis,
            theStationManager.nextStation.stopPointOnSpline.position,
            theStationManager.currentStation.stopPointOnSpline,
            theStationManager.nextStation.stopPointOnSpline);
        thePowerControl.ResetRigidbodyPosition();
        virtualCam.Follow = firstBoogie.transform;
        virtualCam.LookAt = firstBoogie.transform;

        theUIManager.startingInfoCurrentStation.text = theStationManager.currentStation.stationScriptableObject.stationName.ToUpper();
        theUIManager.startingInfoNextStation.text = theStationManager.nextStation.stationScriptableObject.stationName.ToUpper();
        theUIManager.startingInfoNextStationDistance.text = (int)distanceToNextStation + "m";
        theUIManager.startingSectionInfoPanel.gameObject.SetActive(true);

        distanceToSpeedEvents = new float[theStationManager.currentStation.upcomingSpeedEvents.Length];
        distanceRemainingToSpeedEvents = new float[theStationManager.currentStation.upcomingSpeedEvents.Length];
        if (distanceToSpeedEvents.Length != 0)
        {
            for (int i = 0; i < distanceToSpeedEvents.Length; i++)
            {
                distanceToSpeedEvents[i] = GetDistanceOnSpline(
                    carFrontNose.transform.position + Vector3.up * currentTrainSet.noseToSplineYAxis,
                    theStationManager.currentStation.upcomingSpeedEvents[i].transform.position,
                    theStationManager.currentStation.stopPointOnSpline,
                    theStationManager.currentStation.upcomingSpeedEvents[i].transform
                    );
            }
        }

        yield return new WaitForSeconds(5f);

        theScoreManager.currentSectionScore = 0;
        theUIManager.startingSectionInfoPanel.gameObject.SetActive(false);
        theUIManager.DisplayGameplayUI(true);
        theUIManager.CurrentScoreUpdate(theScoreManager.currentScenarioScore);
        theUIManager.playerGearSlider.value = -7;

        theUIManager.DisplaySignalPanel(false);

        yield return new WaitForSeconds(3f);

        yield return StartCoroutine(DisplayTutorialPanel(theUIManager.mainConcernPanel, theUIManager.gameplayUIPanel));
        yield return StartCoroutine(DisplayTutorialPanel(theUIManager.signalTutorialPanel, theUIManager.signalPanel));

        yield return new WaitForSeconds(5f);

        theUIManager.DisplaySignalPanel(true);
        StartCoroutine(thePowerControl.SpeedLimitCheck());
        thePowerControl.TogglePowerLock(false);
        yield return StartCoroutine(DisplayTutorialPanel(theUIManager.gaugeTutorialPanel, theUIManager.gaugeParent));
        yield return new WaitForSeconds(.5f);
        yield return StartCoroutine(DisplayTutorialPanelOnly(theUIManager.gaugeTutorialPanel2));
        yield return new WaitForSeconds(.5f);
        yield return StartCoroutine(DisplayTutorialPanelOnly(theUIManager.gaugeTutorialPanel3));

        yield return new WaitForSeconds(3f);

        theUIManager.signalPanel.gameObject.SetActive(false);

        yield return new WaitForSeconds(5f);

        yield return StartCoroutine(DisplayTutorialPanel(theUIManager.gameplayUITutorialPanel, theUIManager.gameplayUIPanel));

        yield return new WaitForSeconds(5f);

        yield return StartCoroutine(DisplayTutorialPanel(theUIManager.speedEventTutorialPanel, theUIManager.speedEventPanel));

        yield return new WaitForSeconds(15f);

        yield return StartCoroutine(DisplayTutorialPanel(theUIManager.scoreTutorialPanel, theUIManager.scorePanel));
    }