// Use this for initialization void Start() { dijkstraManager = FindObjectOfType <DijkstraManager>(); // Init current level controller. levelController = LevelController.GetCurrentLevelController(); text = text.Replace("<PlayerName>", Constants.playerName); text = text.Replace("<ProfessorName>", Constants.professorName); textWithPlaceholders = text; }
// 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 Awake() { //TODO: replace with either a generic manager or a check if dijkstra is needed LevelProperties levelProp = FindObjectOfType <LevelProperties>(); if (levelProp.gameType == LevelProperties.GameType.Dijkstra) { dijkstraManager = GameObject.FindGameObjectWithTag("Dijkstra").GetComponent <DijkstraManager>(); } else if (levelProp.gameType == LevelProperties.GameType.UniformCost) { uniformCostManager = GameObject.FindGameObjectWithTag("UniformCosts").GetComponent <UniformCostManager>(); } // UI text field for dijkstra routing table information. //routingTableTextField = GetComponentInChildren<Text>(); }
// Use this for initialization void Start() { // Init components. dijkstraManager = FindObjectOfType <DijkstraManager>(); }