Beartimer anzeige und Pingu "death"
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user