Guest User

Untitled

a guest
Jul 31st, 2014
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1.     public class Node
  2.     {
  3.         public delegate void ActionDelegate();
  4.  
  5.         private ActionDelegate[] Actions;
  6.         private int num;
  7.  
  8.         public Node()
  9.         {
  10.             Actions = new ActionDelegate[10];
  11.             num = 0;
  12.         }
  13.  
  14.         public Void DoActions()
  15.         {
  16.             for (int i = 0; i < num; i++)
  17.             {
  18.                 Actions[i]();
  19.                 Actions[i] = null;
  20.             }
  21.             num = 0;
  22.         }
  23.      
  24.         public void Register(ActionDelegate action)
  25.         {
  26.             if (num == Actions.Length)
  27.             {
  28.                 var new_actions = new ActionDelegate[Actions.Length + 10];
  29.                 for (int i = 0; i < Actions.Length; i++)
  30.                     new_actions[i] = Actions[i];
  31.                 Actions = new_actions;
  32.             }
  33.  
  34.             Actions[num] = action;
  35.             num++;
  36.         }
  37.  
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment