// Use this for initialization void Start() { //Start by getting the animator component animator = GetComponent <Animator> (); //Finds the player's position player = GameObject.FindGameObjectWithTag("PlayerBody").transform; //Sets the speech time according to audio speechTime = 19.5f; //The second part of the speech to control automatic movement endSpeechTime = 5; //Instantiates the player controller to use its methods GameObject playerControllerObject = GameObject.FindWithTag("PlayerBody"); if (playerControllerObject != null) { playerController = playerControllerObject.GetComponent <PlayerController> (); } //Instantiates the credits controller to start the image positioning and exhibition GameObject ScreenCreditsControllerObject = GameObject.FindWithTag("CreditsController"); if (ScreenCreditsControllerObject != null) { screenCreditsController = ScreenCreditsControllerObject.GetComponent <ScreenCreditsController> (); } }
private bool started; //Used to avoid setting the variable multiple times during the credits // Use this for initialization void Start() { //Looks for the Credits controller to instantiate GameObject ScreenCreditsControllerObject = GameObject.FindWithTag("CreditsController"); if (ScreenCreditsControllerObject != null) { screenCreditsController = ScreenCreditsControllerObject.GetComponent <ScreenCreditsController> (); } //Starts as false because it should be run on first Update started = false; }