sleepingBear

This commit is contained in:
2026-01-25 22:08:14 +01:00
parent 4731404294
commit b1b3332b49
7 changed files with 6075 additions and 11 deletions
-9
View File
@@ -17,7 +17,6 @@ public class BearAwareness : MonoBehaviour
public AudioClip Awake;
public static bool isPaused = false;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
@@ -40,7 +39,6 @@ public class BearAwareness : MonoBehaviour
if (awarenessSlider.value >= awarenessSlider.maxValue)
{
isPaused = true;
SoundEffectManager.Play("Alert");
BackgroundManager.StopBG();
BackgroundManager.PlayBG(true,Awake);
@@ -54,13 +52,6 @@ public class BearAwareness : MonoBehaviour
while (true)
{
Debug.Log(isPaused);
while (isPaused)
{
Debug.Log("Pause");
}
yield return new WaitForSeconds(delay);
awarenessSlider.value -= 2;
+11 -2
View File
@@ -18,6 +18,10 @@ public class BearIsAwake : MonoBehaviour
public AudioClip BG;
public AudioClip Awake;
public GameObject sleepingBear;
public GameObject awakeBear;
private void Start()
{
BearAwareness.HasWokenUp += IsAwake;
@@ -33,17 +37,22 @@ public class BearIsAwake : MonoBehaviour
{
timer += Time.deltaTime;
bearTimer.fillAmount = timer / bearAwareness.timeToWakeUp;
bearAwareness.awarenessSlider.value = bearAwareness.awarenessSlider.maxValue;
}
}
public void IsAwake(float time)
{
wakingUp = true;
StartCoroutine(SleepIsOver(time));
sleepingBear.SetActive(false);
awakeBear.SetActive(true);
}
IEnumerator SleepIsOver(float time)
{
yield return new WaitForSeconds(time);
//Vector3 direction = Penguin.position - transform.position;
@@ -96,7 +105,8 @@ public class BearIsAwake : MonoBehaviour
elapsed += Time.deltaTime;
}
BearAwareness.isPaused = false;
sleepingBear.SetActive(true);
awakeBear.SetActive(false);
//if (Physics.Raycast(transform.position, direction, out RaycastHit hit, distance))
//{
@@ -130,7 +140,6 @@ public class BearIsAwake : MonoBehaviour
private void OnTriggerEnter(Collider other)
{
BearAwareness.isPaused = true;
SoundEffectManager.Play("Alert");
BackgroundManager.StopBG();
BackgroundManager.PlayBG(true,Awake);