Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. public class HealthDecreaser
  2. {
  3. Action OnHealthDecrease;
  4. public void SignUp(Action action)
  5. {
  6. OnHealthDecrease -= action;
  7. OnHealthDecrease += action;
  8. }
  9. public void DecreaseHealth(float damageValue)
  10. {
  11. if(damageValue > 0)
  12. {
  13. health = Mathf.Max(0, health - damageValue);
  14. OnHealthDecrease();
  15. }
  16. }
  17. }
  18.  
  19. public class FartGenerator
  20. {
  21. public DoFarts()
  22. {
  23. }
  24. }
  25.  
  26. public class AnusPuller
  27. {
  28. public PullAnus()
  29. {
  30. }
  31. }
  32.  
  33. /////////////////////////////////////
  34. HealthDecreaser healthDecreaser = new HealthDecreaser();
  35. FartGenerator fartGenerator = new FartGenerator();
  36. healthDecreaser.SignUp(fartGenerator.DoFarts);
  37. AnusPuller anusPuller = new AnusPuller();
  38. healthDecreaser.SignUp(anusPuller.PullAnus);
  39.  
  40. //////////////////////////////////////////
  41. healthDecreaser.DecreaseHealth(12,344f);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement