Last active
May 6, 2020 18:06
-
-
Save DannyRusnok/54f464b5d62e70dfa735b9e77e048bec to your computer and use it in GitHub Desktop.
State Pattern - SleepState
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SleepState : IDogState | |
{ | |
public void EnterState(DogContext context) | |
{ | |
context.SlowMetabolism(); | |
context.Vision = false; | |
/*etc.. there are examples what might a Dog class do*/ | |
} | |
public void Bark(DogContext context) { throw new NotSupportStateTransitionException(); } | |
public void Sleep(DogContext context) { throw new NotSupportStateTransitionException(); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment