Advertisement
7heSama

StateManagement thru LinkedList

Dec 10th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. public virtual void Entered(GameState next)
  2. {
  3.     string nextName = "[null]";
  4.     if (next != null)
  5.     {
  6.         nextName = next.Name;
  7.         //next.Obscuring();
  8.         Next = next;
  9.     }
  10.  
  11.     Console.WriteLine("Entered " + Name + ", obscuring: " + nextName);
  12. }
  13.  
  14. public virtual void Leaving()
  15. {
  16.     Console.WriteLine("Leaving " + Name);
  17.     while (Next != null && !Next.Active)
  18.     {
  19.         Next.Leaving();
  20.         Next = Next.Next;
  21.         Next.Entered(Next.Next);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement