using System.Collections; using System.Collections.Generic; using UnityEngine; public class BlockManager : MonoBehaviour { public enum BlockType {None, Barricade, Door, Wood, Ammo}; public BlockType blockType = BlockType.None; public float health = 100; private Animator animator; private bool action = false; // Start is called before the first frame update void Start() { if (blockType == BlockType.Door) { animator = this.GetComponent(); } } // Update is called once per frame void Update() { } public void Action() { if (blockType == BlockType.Door) { if (!action) { this.GetComponent().isTrigger = true; action = true; } else { this.GetComponent().isTrigger = false; action = false; } animator.ResetTrigger("Door"); animator.SetTrigger("Door"); } } }