// Use this for initialization void Start() { // Get a reference to the DijkstraManager. GameObject dijkstraManagerGO = GameObject.FindGameObjectWithTag("Dijkstra"); dijkstraManager = dijkstraManagerGO.GetComponent <DijkstraManager>(); // Get a reference to the SoundManager. soundManager = FindObjectOfType <SoundManager>(); // Get a reference to the ScoreTextManager. GameObject scoreTextGO = GameObject.FindGameObjectWithTag("ScoreTextManager"); scoreTexts = scoreTextGO.GetComponent <ScoreTextScript>(); // Get a reference to the MovementScript. movementScript = GameObject.FindGameObjectWithTag("Player").GetComponent <MovementScript>(); scoreBeer = FindObjectOfType <ScoreBeer>(); playerController = FindObjectOfType <PlayerController>(); LevelProperties lp = FindObjectOfType <LevelProperties>(); scoreBeer.SetMaxScore(lp.levelMaxScore); // Set the max score defined in the level properties. // Start the dijkstra algorithm. dijkstraManager.StartDijkstraAlgorithm(startingRouter.GetComponent <RouterScript>()); // Perform pre load move. movementScript.PerformPreLoadMove(startingRouter); movementScript.SubscribeToTargetPositionArrivedEvent(ReachedTargetPoint); // UI text fields for dijkstra routing table information. routingTableUI = GameObject.FindGameObjectWithTag("RoutingTableUI").GetComponent <RoutingTableUI>(); routingTableUI.UpdateRoutingTableUI(); player = FindObjectOfType <MovementScript>().gameObject; if (logToFile) { LevelProperties levelProperties = FindObjectOfType <LevelProperties>(); Debug.Log("Logging to file!"); levelLogging = new LevelLogging(levelProperties.levelName, " MaxScore=" + levelProperties.levelMaxScore + ", Type=" + levelProperties.gameType, PlayerPrefs.GetString("name")); //audio WriteToLog("Sound; Master: " + PlayerPrefs.GetFloat(AudioMenuMain.MASTER_VOL)); WriteToLog("Sound; Game: " + PlayerPrefs.GetFloat(AudioMenuMain.GAME_VOL)); WriteToLog("Sound; UI: " + PlayerPrefs.GetFloat(AudioMenuMain.UI_VOL)); WriteToLog("Sound; Professor: " + PlayerPrefs.GetFloat(AudioMenuMain.PROF_VOL)); WriteToLog("Sound; Background: " + PlayerPrefs.GetFloat(AudioMenuMain.BACKGROUND_VOL)); WriteToLogAppendScore("Start; Starting Game"); } }
// Use this for initialization void Start() { levelProperties = FindObjectOfType <LevelProperties>(); scoreBeer = FindObjectOfType <ScoreBeer>(); // Get reference to the ScoreTextManager. GameObject scoreTextGO = GameObject.FindGameObjectWithTag("ScoreTextManager"); scoreTexts = scoreTextGO.GetComponent <ScoreTextScript>(); professorController = FindObjectOfType <ProfessorController>(); if (!ApplicationState.levelRestarted) { StartCoroutine(ShowProfessorAfterTime()); player.SetActive(false); } gameState = FindObjectOfType <GameState>(); // Calculate max score. int maxScore = determineMaxScore(); FindObjectOfType <ScoreBeer>().SetMaxScore(maxScore); }