36 lines
675 B
C#
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;
|
|
}
|
|
}
|
|
}
|