Aetheria/Assets/Scripts/ServerShared/ActionCollection.cs
hyperion51 e96146b7bb Out with MagicOnion, in with LiteNetLib
Removed MagicOnion
Added LiteNetLib
Created client and server abstractions
Fixed serialization bugs
2020-03-24 14:36:22 +00:00

28 lines
No EOL
546 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
public abstract class NotAnActionCollection{}
public class ActionCollection<T> : NotAnActionCollection where T : Message
{
private List<Action<T>> _actions = new List<Action<T>>();
public void Add(Action<T> action)
{
_actions.Add(action);
}
public void Invoke(T message)
{
foreach (var action in _actions)
{
action(message);
}
}
public void Clear()
{
_actions.Clear();
}
}