30 lines
806 B
C#
30 lines
806 B
C#
using UnityEngine;
|
|
|
|
namespace InterfaceOff
|
|
{
|
|
public class TrollWindow : WindowBase
|
|
{
|
|
private int m_Health = int.MaxValue;
|
|
|
|
public override void OnWindowInstantiation()
|
|
{
|
|
m_Health = Random.Range(2, 6);
|
|
Components.InfoText.text = "TROLL";
|
|
}
|
|
|
|
public override void OnWindowClicked()
|
|
{
|
|
/* Decreases health and destroys if at 0 */
|
|
m_Health--;
|
|
if (m_Health <= 0)
|
|
{
|
|
Destroy(gameObject);
|
|
return;
|
|
}
|
|
|
|
/* If not at zero randomly moves the close button */
|
|
float randX = Random.Range(-80, 80);
|
|
Components.CloseButtonRectTransform.anchoredPosition = new Vector2(randX, 0);
|
|
}
|
|
}
|
|
} |