32 lines
675 B
C#
Executable file
32 lines
675 B
C#
Executable file
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class IceBlock : MonoBehaviour
|
|
{
|
|
public int IceStrength;
|
|
private Animator animator;
|
|
|
|
private void Start()
|
|
{
|
|
animator = GetComponent<Animator>();
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|