ChestAnimaton (beta)
This commit is contained in:
35
3D blobici/Assets/Scripts/Objects/ChestLogic.cs
Normal file
35
3D blobici/Assets/Scripts/Objects/ChestLogic.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
3D blobici/Assets/Scripts/Objects/ChestLogic.cs.meta
Normal file
2
3D blobici/Assets/Scripts/Objects/ChestLogic.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9270408fc9f30214a9251fc41f379f0e
|
||||
Reference in New Issue
Block a user