using UnityEngine; namespace InterfaceOff { public class MovingWindow : WindowBase { private int m_Health = int.MaxValue; public override void OnWindowInstantiation() { /* Creates a random health value */ m_Health = Random.Range(2, 6); Components.InfoText.text = $"{m_Health}"; } public override void OnWindowClicked() { /* Decreases health and destroys if at 0 */ m_Health--; Components.InfoText.text = $"{m_Health}"; if (m_Health <= 0) { Destroy(gameObject); } } } }