// Start is called before the first frame update void Awake() // BUG if not setting to Awake. Why? Global Control? { // Initialise components gameManager = FindObjectOfType <GameManager>().GetComponent <GameManager>(); uiManager = FindObjectOfType <GameManager>().GetComponent <UIManager>(); routeManager = FindObjectOfType <GameManager>().GetComponent <RouteManager>(); intersectionManager = FindObjectOfType <GameManager>().GetComponent <IntersectionManager>(); saveSessionData = GetComponent <SaveSessionData>(); lastCheckpointCollected = 0; // }
//public bool cameraTilt = true; private void Awake() { // _controls = new PlayerControl(); playerCamera = Camera.main; //Set playerCamera to camera with 'main'tag playerRb = GetComponent <Rigidbody>(); gameManager = FindObjectOfType <GameManager>().GetComponent <GameManager>(); intersectionManager = FindObjectOfType <GameManager>().GetComponent <IntersectionManager>(); uiManager = FindObjectOfType <GameManager>().GetComponent <UIManager>(); sequenceManager = FindObjectOfType <GameManager>().GetComponent <SequenceManager>(); routeManager = FindObjectOfType <GameManager>().GetComponent <RouteManager>(); screenshotManager = FindObjectOfType <GameManager>().GetComponent <ScreenshotManager>(); checkpointManager = FindObjectOfType <GameManager>().GetComponent <CheckpointManager>(); hotspotManager = FindObjectOfType <GameManager>().GetComponent <HotspotManager>(); saveSessionData = FindObjectOfType <GameManager>().GetComponent <SaveSessionData>(); }
public bool overideOnIntersectionExit; //Using when resetting route manually // Start is called before the first frame update private void Awake() { // Initialise GameObjects and components player = GameObject.FindGameObjectWithTag("Player"); playerController = player.GetComponent <PlayerController>(); intersectionManager = GetComponent <IntersectionManager>(); routeManager = GetComponent <RouteManager>(); sequenceManager = GetComponent <SequenceManager>(); uiManager = GetComponent <UIManager>(); checkpointManager = GetComponent <CheckpointManager>(); saveSessionData = GetComponent <SaveSessionData>(); overideOnIntersectionExit = false; sessionData = GlobalControl.instance.sessionData; // Import data session from GlobalControl Debug.Log("GAME MANAGER (pause): " + sessionData.sessionPaused); SetPaths(); // Set paths for importing and exporting data InitialiseSession(); // Initialise variables for session start //Debug.Log("(gamemanager) Distance: " + sessionDistance); }