init
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using UnityEngine.Events;
|
||||
using VOID.Generic.Objects.Abstract.Events;
|
||||
|
||||
namespace VOID.Generic.AI.Schema
|
||||
{
|
||||
public class SchemaUnitEventWrapper<TUnitEvent, TMemory> where TUnitEvent : AbstractEvent
|
||||
{
|
||||
private UnityEvent<TUnitEvent> _listener;
|
||||
private UnityAction<TUnitEvent> _action;
|
||||
|
||||
public SchemaUnitEventWrapper(
|
||||
UnityEvent<TUnitEvent> addListenerTo,
|
||||
UnityAction<TUnitEvent, TMemory, UnitObjectSchemaAgent> action,
|
||||
UnitObjectSchemaAgent agent,
|
||||
TMemory memory)
|
||||
{
|
||||
_listener = addListenerTo;
|
||||
_action = t1 => action.Invoke(t1, memory, agent);
|
||||
}
|
||||
|
||||
public void On()
|
||||
{
|
||||
_listener.AddListener(_action);
|
||||
}
|
||||
|
||||
public void Off()
|
||||
{
|
||||
_listener.RemoveListener(_action);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user