Beartimer anzeige und Pingu "death"

This commit is contained in:
2026-01-25 12:10:21 +01:00
parent 7d6579dce7
commit 2a86b6211d
5 changed files with 239 additions and 8 deletions
+23 -2
View File
@@ -1,19 +1,36 @@
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public class BearIsAwake : MonoBehaviour
{
public Transform Penguin;
public Image bearTimer;
private float timer = 0f;
private bool wakingUp = false;
public BearAwareness bearAwareness;
public PositionReset penguinReset;
public PositionReset iceBlockReset;
private void Start()
{
BearAwareness.HasWokenUp += IsAwake;
}
private void Update()
{
if (wakingUp)
{
timer += Time.deltaTime;
bearTimer.fillAmount = timer / bearAwareness.timeToWakeUp;
}
}
public void IsAwake(float time)
{
wakingUp = true;
StartCoroutine(SleepIsOver(time));
}
@@ -32,6 +49,8 @@ public class BearIsAwake : MonoBehaviour
if (hit.collider.name == "StandUpCollider")
{
Debug.Log("Your Dead!");
penguinReset.Reset();
iceBlockReset.Reset();
}
else
{
@@ -39,7 +58,9 @@ public class BearIsAwake : MonoBehaviour
}
}
wakingUp = false;
timer = 0f;
bearTimer.fillAmount = 0;
Debug.DrawLine(transform.position, Penguin.position, Color.red, 10f);
}
}