Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Node
- {
- public delegate void ActionDelegate();
- private ActionDelegate[] Actions;
- private int num;
- public Node()
- {
- Actions = new ActionDelegate[10];
- num = 0;
- }
- public Void DoActions()
- {
- for (int i = 0; i < num; i++)
- {
- Actions[i]();
- Actions[i] = null;
- }
- num = 0;
- }
- public void Register(ActionDelegate action)
- {
- if (num == Actions.Length)
- {
- var new_actions = new ActionDelegate[Actions.Length + 10];
- for (int i = 0; i < Actions.Length; i++)
- new_actions[i] = Actions[i];
- Actions = new_actions;
- }
- Actions[num] = action;
- num++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment