using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; /// /// This script defines which sprite the 'Player" uses and its health. /// public class Player : MonoBehaviour { public GameObject destructionFX; public static Player instance; private void Awake() { if (instance == null) instance = this; } //method for damage proceccing by 'Player' public void GetDamage(int damage) { Destruction(); } //'Player's' destruction procedure void Destruction() { Instantiate(destructionFX, transform.position, Quaternion.identity); //generating destruction visual effect and destroying the 'Player' object Destroy(gameObject); } }