public void StartChapter() { dialogManager = GameObject.Find("DialogManager").GetComponent <DialogManager>(); storyProgress = GameObject.Find("StoryManager").GetComponent <StoryProgress>(); //Activate all Chapter3's in every room GameObject[] Chapter3GOs = storyProgress.Chapter3GOs; foreach (GameObject Chapter3GO in Chapter3GOs) { Chapter3GO.SetActive(true); } // Disable all GO's that need to appear during quests C3_Epilog_BarPeople.SetActive(false); //Enable all GO's that need to appear during this chapter // Start Chapter3 intro FindObjectOfType <AudioManager>().ToggleCanPlayBackgroundMusic(false); blackScreen.SetActive(true); GameObject.Find("Utils").GetComponent <Utilities>().RespawnPlayer(C3_Intro_Spawn, false); blackScreen.GetComponent <Image>().color = new Color32(0, 0, 0, 255); //set it to black chapterScreen.SetActive(true); chapterText.text = "Chapter 3"; chapterQuoteText.text = "Life is a sum of all your choices. \n ~ Albert Camus"; StartCoroutine(FadeTextInAndOut(chapterText)); StartCoroutine(FadeTextInAndOut(chapterQuoteText)); GameObject.Find("Player").GetComponent <PlayerMovement>().ToggleCanMove(false); GameObject.Find("Player").GetComponent <PlayerAction>().ToggleCanInteract(false); }
//CHAPTER 1 VARIABLES // Start is called before the first frame update void Start() { if (isDebug) { Debug.Log("Debugging."); chapter = -1; //for (int i = 0; i < transform.childCount; i++) { // Destroy(transform.GetChild(i).gameObject); //} //Destroy(this); } if (isDebug == false) { //Assume all Chapter GameObjects in every room are disabled. Thus, find all StoryGameObjects and activate all his children so as to get references to them. storyGO = GameObject.FindGameObjectsWithTag("StoryGameObject"); foreach (GameObject sGO in storyGO) { for (int i = 0; i < sGO.transform.childCount; i++) { sGO.transform.GetChild(i).gameObject.SetActive(true); } } if (overrideChapter == false) { //load data chapter = PlayerPrefs.GetInt("Chapter", 1); trialVictimName = PlayerPrefs.GetString("TrialVictimName", "XXX"); GameObject.Find("Player").GetComponent <PlayerSprite>().playerFemale = PlayerPrefs.GetInt("PlayerFemale", 1) == 1?true:false; } //First, disable every Chapter1 child of every room Chapter1GOs = GameObject.FindGameObjectsWithTag("Chapter1"); foreach (GameObject Chapter1GO in Chapter1GOs) { Chapter1GO.SetActive(false); } //Disable every Chapter2 child of every room Chapter2GOs = GameObject.FindGameObjectsWithTag("Chapter2"); foreach (GameObject Chapter2GO in Chapter2GOs) { Chapter2GO.SetActive(false); } //Disable every Chapter3 child of every room Chapter3GOs = GameObject.FindGameObjectsWithTag("Chapter3"); foreach (GameObject Chapter3GO in Chapter3GOs) { Chapter3GO.SetActive(false); } if (chapter == 1) { chapter1.GetComponent <Chapter1Progress>().StartChapter(); } if (chapter == 2) { chapter2.GetComponent <Chapter2Progress>().StartChapter(); } if (chapter == 3) { chapter3.GetComponent <Chapter3Progress>().StartChapter(); } } }