UnityGame/Library/PackageCache/com.unity.visualscripting/Runtime/VisualScripting.Flow/Framework/Events/BoltUnityEvent.cs

37 lines
1.0 KiB
C#
Raw Normal View History

2024-10-27 10:53:47 +03:00
using System.ComponentModel;
namespace Unity.VisualScripting
{
/// <summary>
/// Called when a UnityEvent points to TriggerUnityEvent.
/// </summary>
[UnitCategory("Events")]
[UnitTitle("UnityEvent")]
[UnitOrder(2)]
[DisplayName("Visual Scripting Unity Event")]
public sealed class BoltUnityEvent : MachineEventUnit<string>
{
protected override string hookName => EventHooks.UnityEvent;
/// <summary>
/// The name of the event. The event will only trigger if this value
/// is equal to the string parameter passed in the UnityEvent.
/// </summary>
[DoNotSerialize]
[PortLabelHidden]
public ValueInput name { get; private set; }
protected override void Definition()
{
base.Definition();
name = ValueInput(nameof(name), string.Empty);
}
protected override bool ShouldTrigger(Flow flow, string name)
{
return CompareNames(flow, this.name, name);
}
}
}