using System.Collections; using System.Collections.Generic; using UnityEngine; public class IceBlock : MonoBehaviour { public int IceStrength; private Animator animator; private void Start() { animator = GetComponent(); } private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Player") { IceStrength--; if (IceStrength < 1) { //animator.SetTrigger("Break"); Invoke("Destroy", 0.5f); } } } private void Destroy() { Destroy(this.gameObject); } }