projectEli/Assets/NeoFPS/Core/Utilities/ToggleOrHold/ToggleOrHoldEvent.cs

43 lines
875 B
C#
Raw Normal View History

2022-11-07 01:28:33 +00:00
using UnityEngine;
using System;
using UnityEngine.Events;
namespace NeoFPS
{
public class ToggleOrHoldEvent : ToggleOrHold
{
public ToggleOrHoldEvent() : base(null)
{}
public ToggleOrHoldEvent(Func<bool> isBlockedCallback) : base(isBlockedCallback)
{}
public ToggleOrHoldEvent(UnityAction onAct, UnityAction onDeact) : base(null)
{
onActivate += onAct;
onDeactivate += onDeact;
}
public ToggleOrHoldEvent(UnityAction onAct, UnityAction onDeact, Func<bool> isBlockedCallback) : base(isBlockedCallback)
{
onActivate += onAct;
onDeactivate += onDeact;
}
public event UnityAction onActivate;
public event UnityAction onDeactivate;
protected override void OnActivate ()
{
if (onActivate != null)
onActivate ();
}
protected override void OnDeactivate ()
{
if (onDeactivate != null)
onDeactivate ();
}
}
}