projectEli/Assets/NeoFPS/Core/MotionGraphs/Parameters/EventParameter.cs

29 lines
556 B
C#
Raw Normal View History

2022-11-07 01:28:33 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
namespace NeoFPS.CharacterMotion.Parameters
{
[MotionGraphElement("Event", "My Event")]
public class EventParameter : MotionGraphParameter
{
private event UnityAction onInvoked;
public void Invoke ()
{
if (onInvoked != null)
onInvoked ();
}
public void AddListener (UnityAction listener)
{
onInvoked += listener;
}
public void RemoveListener (UnityAction listener)
{
onInvoked -= listener;
}
}
}