public void incrementMood(int moodValue) { if (day < STARTING_DAY) { day = STARTING_DAY; displayDay(); } moodScore += moodValue; Debug.Log("Incrementing moodValue: " + moodValue + " New score: " + moodScore); time += 1; if (time >= END_OF_DAY_THRESHOLD) { endDay(); } displayTime(); moodBar.SetMood(moodScore); if (moodScore >= UPPER_MOOD_THRESHOLD) { endGame(PossibleEndStates.Win); audioSource.volume = audioSource.volume / 50; } else if (moodScore <= LOWER_MOOD_THRESHOLD) { endGame(PossibleEndStates.Lose); audioSource.volume = audioSource.volume / 50; } else if (moodScore < 50) { if (audioSource.clip == neutralMusic) { audioSource.clip = lowMoodMusic; audioSource.Play(); } } else { if (audioSource.clip == lowMoodMusic) { audioSource.clip = neutralMusic; audioSource.Play(); } } }
// Start is called before the first frame update void Start() { moodScore = STARTING_SCORE; moodBar = moodCanvas.GetComponent <MoodBar>(); time = STARTING_TIME; day = STARTING_DAY; dialogueManager.StartDialogue(openingText); displayDay(); displayTime(); moodBar.SetMaxMood(UPPER_MOOD_THRESHOLD); moodBar.SetMood(moodScore); gameIsActive = true; pauseMenuUI.SetActive(false); audioSource.clip = neutralMusic; audioSource.volume = AUDIO_VOLUME; audioSource.Play(); }