void Start() { Debug.Log("Starting Guard Chase"); inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>(); if(inventory.ShowInterface) { inventory.ToggleInterface(); } StartCoroutine(SetUpAnimation()); }
IEnumerator SetUpLevel() { TimeManagment.isTimePaused = true; try { inventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent<Inventory>(); if(inventory && inventory.ShowInterface) { inventory.ToggleInterface(); } } catch(System.Exception) { Debug.LogWarning("Cannot find inventory"); } try { player = GameObject.FindGameObjectWithTag("Player").GetComponent<CrazyBastard>(); } catch(System.Exception) { Debug.LogWarning("Cannot find player"); } yield return new WaitForSeconds(0.5f); if(player) player.EnableMove = false; yield return new WaitForSeconds(animation["QuoteAnimation"].length - 1.75f); if(player) player.EnableMove = true; if(Application.loadedLevelName != "EndScreen") { TimeManagment.isTimePaused = false; } }