//Turns off text box, enables player movement, resets conversationscript index void EndConvo() { diaButton.SwitchingState(); convoScript.convoIndex = 0; convoScript.convoDone = false; dialogue = temp; faceArray = faceTemp; AdvanceDialogue(); }
//When something hits its 2D collider void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.tag.Equals("Player")) { //----------Special Cases only During Tutorial---------------- if (IsSceneTutorial()) { dButton = GameObject.FindGameObjectWithTag("ConvoUIButton").GetComponent <DialogueButton>(); dButton.SwitchingState(); //turns on dialogue when levels is finished } if (GlobalVars.isTutorial) //if a level is completed before the game "crashes" { crashing = true; //activate crashing prompt } //------------------This is normal----------------- else //Display the result values { _text.text = "Final Time Is: " + totalTime.ToString(); _panel.gameObject.SetActive(true); _panel.transform.Find("BronzeText").GetComponent <Text>().text = BronzeTime.ToString() + ".00"; _panel.transform.Find("SilverText").GetComponent <Text>().text = SilverTime.ToString() + ".00"; _panel.transform.Find("GoldText").GetComponent <Text>().text = GoldTime.ToString() + ".00"; } endTime = true; //stop the timer int medalNum = 0; if (SceneManager.GetActiveScene().name != "Tutorial") //calcuates the level time into medals { medalNum = MedalHandler.CalcMedalType(BronzeTime, SilverTime, GoldTime, totalTime); } else //just show the medals if it is the tutorial { medalNum = 3; } switch (medalNum) //activates a medal based upon the number it gets { case 3: goldMedal.gameObject.SetActive(true); goto case 2; case 2: silverMedal.gameObject.SetActive(true); goto case 1; case 1: bronzeMedal.gameObject.SetActive(true); break; default: print(":("); break; } //stop time if the level isn't the tutorial. We need time to still be functioning in the tutorial for animations to play if (!IsSceneTutorial()) { Time.timeScale = 0; } } }