Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace BossFightGame.Scripts
- {
- public class HealthSystem
- {
- private int health;
- public event Action<int> onHealthChanged;
- public HealthSystem(int health)
- {
- this.health = health;
- }
- public int GetHealth()
- {
- return health;
- }
- public void Damage(int damageAmount)
- {
- health -= damageAmount;
- onHealthChanged?.Invoke(health);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement