IEnumerator RestartMemories() { SoundManager.instance.StopFadeOut("Main", 4f); SoundManager.instance.PlayFadeIn("Noise", 4f); yield return(new WaitForSeconds(2f)); SetDementiaValue(4); yield return(new WaitForSeconds(3f)); blackOutSquare.SetActive(true); Color objectColor = blackOutSquare.GetComponent <Image>().color; float fadeAmount; float fadeSpeed = 1; while (blackOutSquare.GetComponent <Image>().color.a < 1) { fadeAmount = objectColor.a + fadeSpeed * Time.deltaTime; objectColor = new Color(objectColor.r, objectColor.g, objectColor.b, fadeAmount); blackOutSquare.GetComponent <Image>().color = objectColor; yield return(null); } conversationController.ChangeConversation(lastConversationCheckpoint); conversationController.AdvanceLine(); SetDementiaValue(1); while (blackOutSquare.GetComponent <Image>().color.a > 0) { fadeAmount = objectColor.a - fadeSpeed * Time.deltaTime; objectColor = new Color(objectColor.r, objectColor.g, objectColor.b, fadeAmount); blackOutSquare.GetComponent <Image>().color = objectColor; yield return(null); } blackOutSquare.SetActive(false); canContinue = true; SoundManager.instance.Play("Main"); SoundManager.instance.Stop("Noise"); yield return(null); }
//Make choice on click button, the conversation is changed depending on the choice and the dialogue is hidden public void MakeChoice() { conversationController.ChangeConversation(choice.conversation); questionController.Hide(); if (choice.increaseDementia) { TestConversation.instance.IncreaseDementia(); } else if (choice.decreaseDementia) { TestConversation.instance.DecreaseDementia(); } else if (choice.setDementiaValue != 0) { TestConversation.instance.SetDementiaValue(choice.setDementiaValue); SoundManager.instance.PlayOneShot("Glitch"); } else { SoundManager.instance.PlayOneShot("Click"); } }