Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public class Health : MonoBehaviour {
- public int currentHealth = 10;
- public void Damage(int value) {
- currentHealth -= value;
- if (currentHealth < 0) {
- currentHealth = 0;
- }
- if (currentHealth == 0) {
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement