Advertisement
kadyr

Untitled

Nov 6th, 2021
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. using System;
  2.  
  3. namespace BossFightGame.Scripts
  4. {
  5. public class HealthSystem
  6. {
  7. private int health;
  8. public event Action<int> onHealthChanged;
  9.  
  10. public HealthSystem(int health)
  11. {
  12. this.health = health;
  13. }
  14.  
  15. public int GetHealth()
  16. {
  17. return health;
  18. }
  19.  
  20. public void Damage(int damageAmount)
  21. {
  22. health -= damageAmount;
  23. onHealthChanged?.Invoke(health);
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement