fine
This commit is contained in:
@@ -13,9 +13,11 @@ public class BearAwareness : MonoBehaviour
|
||||
|
||||
public static event Action<float> HasWokenUp;
|
||||
|
||||
public float timeToWakeUp = 2f;
|
||||
public float timeToWakeUp = 4f;
|
||||
|
||||
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()
|
||||
{
|
||||
@@ -36,15 +38,14 @@ public class BearAwareness : MonoBehaviour
|
||||
//awareness += noice;
|
||||
awarenessSlider.value += noice;
|
||||
|
||||
if (awareness >= awarenessSlider.maxValue)
|
||||
if (awarenessSlider.value >= awarenessSlider.maxValue)
|
||||
{
|
||||
isPaused = true;
|
||||
SoundEffectManager.Play("Alert");
|
||||
BackgroundManager.StopBG();
|
||||
BackgroundManager.PlayBG(true,Awake);
|
||||
StopAllCoroutines();
|
||||
Debug.Log("Bear is awake now!");
|
||||
HasWokenUp.Invoke(timeToWakeUp);
|
||||
StartCoroutine(Decrease(2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +54,13 @@ public class BearAwareness : MonoBehaviour
|
||||
|
||||
while (true)
|
||||
{
|
||||
Debug.Log(isPaused);
|
||||
|
||||
while (isPaused)
|
||||
{
|
||||
Debug.Log("Pause");
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(delay);
|
||||
|
||||
awarenessSlider.value -= 2;
|
||||
|
||||
@@ -95,7 +95,8 @@ public class BearIsAwake : MonoBehaviour
|
||||
}
|
||||
elapsed += Time.deltaTime;
|
||||
}
|
||||
|
||||
|
||||
BearAwareness.isPaused = false;
|
||||
|
||||
//if (Physics.Raycast(transform.position, direction, out RaycastHit hit, distance))
|
||||
//{
|
||||
@@ -129,6 +130,7 @@ public class BearIsAwake : MonoBehaviour
|
||||
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
BearAwareness.isPaused = true;
|
||||
SoundEffectManager.Play("Alert");
|
||||
BackgroundManager.StopBG();
|
||||
BackgroundManager.PlayBG(true,Awake);
|
||||
|
||||
Reference in New Issue
Block a user