41 lines
954 B
C#
41 lines
954 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ChestAnimation : MonoBehaviour
|
|
{
|
|
[SerializeField] public GameObject chest;
|
|
|
|
private Animator m_Animator;
|
|
bool isTrigerred = false;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
m_Animator = gameObject.GetComponent<Animator>();
|
|
chest = gameObject; // set object on current GameObject
|
|
}
|
|
|
|
private bool beingHandled = false;
|
|
private static bool Opening;
|
|
private static bool Closing;
|
|
private IEnumerator OpenChestWithAnimation()
|
|
{
|
|
beingHandled = true;
|
|
// process pre-yield
|
|
m_Animator.SetTrigger("OpenIt");
|
|
yield return new WaitForSeconds( 0.4f );
|
|
|
|
m_Animator.ResetTrigger("OpenIt");
|
|
// process post-yield
|
|
beingHandled = false;
|
|
}
|
|
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|