Komplett Lauffähig + Vibration + Boni + Enemie "Jumpscares" - Audio

This commit is contained in:
2026-02-17 21:15:37 +01:00
parent 8b0452b1ed
commit 655e91627a
54 changed files with 8214 additions and 403 deletions

View File

@@ -1,15 +1,53 @@
using JetBrains.Annotations;
using UnityEngine;
public class DoorController : MonoBehaviour
{
[SerializeField] private Door door;
[SerializeField] GameObject energyScript;
[SerializeField] GameObject inventoryScript;
HandleEnergy energy;
InventoryScript inventory;
float timer = 0f;
private void Awake()
{
energy = energyScript.GetComponent<HandleEnergy>();
inventory = inventoryScript.GetComponent<InventoryScript>();
}
private void Update()
{
if (door.isOpen == false)
{
TimeDoor();
}
}
private void OnMouseDown()
{
if (door.isOpen == true)
{
door.isOpen = false;
Debug.Log("Hier kommt niemand rein");
if (inventory.Energy > 0)
{
Vibrator.Vibrate();
door.isOpen = false;
Debug.Log("Hier kommt niemand rein");
energy.LoseEnergy();
}
else
{
door.isOpen = true;
Debug.Log("Die Tür wird dich nicht mehr retten.");
}
}
else
{
@@ -20,4 +58,16 @@ public class DoorController : MonoBehaviour
//door.isOpen = !door.isOpen;
}
public void TimeDoor()
{
timer += Time.deltaTime;
//Debug.Log(timer); //FUNKTIONAL
if (timer >= 5)
{
door.isOpen = true;
timer = 0f;
}
}
}