public void SetHealth(int value) { if (value > MaxHealth) { value = MaxHealth; } else if (value < 0) { value = 0; } Health = value; MyUI.UpdateHealth(); if (Health <= 0) { Game.GameOver(); } }