// Update is called once per frame /// <summary> /// This Update method checks to make sure we aren't awake yet. Once we are, we disable this script, and enable Ollie's ability to move. /// </summary> void Update() { gameObject.GetComponent <Slider>().value = awakeAmount; if (awakeAmount >= 100 && display.alpha > 0) { GameObject.Find("Ollie_Sprite").GetComponent <Ollie_Move>().enabled = true; display.alpha -= Time.deltaTime; animator.SetTrigger("Wakeup"); animator.Play("Wakeup"); animator.StartPlayback(); animator.speed = 1; subManager.DisplaySubtitle("Ollie: I guess I can try today..", 3); } if (awakeAmount > 0 && awakeAmount < 100) { awakeAmount -= (Time.deltaTime) * decaySpeed; gameObject.GetComponent <Slider>().value = awakeAmount; //Update the parent slider. } if (awakeAmount < 100) { if (Input.GetKeyDown(KeyCode.Space)) { awakeAmount += (fillAmount * fillMultipler); gameObject.GetComponent <Slider>().value = awakeAmount; //Update the parent slider. } } }
// method to call when we want to play a sound that will also have subtitles if they are enabled. public void Play() { this.audioSource.Play(); subtitleManager.DisplaySubtitle(caption, captionDuration); }