File size: 1,042 Bytes
18a519f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);
        }
    }
}