Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HealthDecreaser
- {
- Action OnHealthDecrease;
- public void SignUp(Action action)
- {
- OnHealthDecrease -= action;
- OnHealthDecrease += action;
- }
- public void DecreaseHealth(float damageValue)
- {
- if(damageValue > 0)
- {
- health = Mathf.Max(0, health - damageValue);
- OnHealthDecrease();
- }
- }
- }
- public class FartGenerator
- {
- public DoFarts()
- {
- }
- }
- public class AnusPuller
- {
- public PullAnus()
- {
- }
- }
- /////////////////////////////////////
- HealthDecreaser healthDecreaser = new HealthDecreaser();
- FartGenerator fartGenerator = new FartGenerator();
- healthDecreaser.SignUp(fartGenerator.DoFarts);
- AnusPuller anusPuller = new AnusPuller();
- healthDecreaser.SignUp(anusPuller.PullAnus);
- //////////////////////////////////////////
- healthDecreaser.DecreaseHealth(12,344f);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement