Files
3DBlobici-WorkingTitle/3D blobici/Assets/Scripts/Objects/ChestLogic.cs
2025-06-27 08:23:17 +02:00

36 lines
675 B
C#

using UnityEngine;
public class ChestLogic : MonoBehaviour
{
private Animator animator;
private bool isOpen = false;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
animator = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
}
private void OnMouseDown()
{
Debug.Log("Chest clicked");
if (!isOpen)
{
animator.SetTrigger("Open");
isOpen = true;
}
else
{
animator.SetTrigger("Close");
isOpen = false;
}
}
}