//Where the Guard Frog counts down to see if you're within range for long enough. void UpdateTimers() { //I wrote the AwarenessScript script. It controls the bar timer that goes up next to the guard enemy //If you're not in range, count down. otherwise he's seen you if (shouldBeCountingDown) { timeUntilTurnAround -= Time.deltaTime; } else { m_Animator.SetBool("HasSeenYou", true); } //Permanently counting down to when he should turn around. if (timeUntilTurnAround <= 0) { timeUntilTurnAround = walkDistance; if (turnAround) { m_SpriteRenderer.flipX = false; m_Animator.SetBool("IsRight", true); turnAround = false; } else { m_SpriteRenderer.flipX = true; m_Animator.SetBool("IsRight", false); turnAround = true; } } //if he notices you, call this every frame. if (!sliderDown) //Method i created that moves the awareness slider up next to the frog { affectSlider.Notice(Time.deltaTime); } else { //Otherwise, OutOfRange is a method i created that moves the awareness slider down. //it has a minimum amount, so is always bottoming out unless he notices you. affectSlider.OutOfRange(Time.deltaTime); } //used for the spitter enemy projectiles, not us }
//Where the Guard Frog counts down to see if you're within range for long enough. void UpdateTimers() { //I wrote the AwarenessScript script. It controls the bar timer that goes up next to the guard enemy //If you're not in range, count down. otherwise he's seen you //Might need this one //m_Animator.SetBool ("HasSeenYou", true); //Permanently counting down to when he should turn around. //if he notices you, call this every frame. if (!sliderDown) //Method i created that moves the awareness slider up next to the frog { affectSlider.Notice(Time.deltaTime); } else { //Otherwise, OutOfRange is a method i created that moves the awareness slider down. //it has a minimum amount, so is always bottoming out unless he notices you. affectSlider.OutOfRange(Time.deltaTime); } //used for the spitter enemy projectiles, not us }