No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BoltUnityEvent.cs 1.0KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System.ComponentModel;
  2. namespace Unity.VisualScripting
  3. {
  4. /// <summary>
  5. /// Called when a UnityEvent points to TriggerUnityEvent.
  6. /// </summary>
  7. [UnitCategory("Events")]
  8. [UnitTitle("UnityEvent")]
  9. [UnitOrder(2)]
  10. [DisplayName("Visual Scripting Unity Event")]
  11. public sealed class BoltUnityEvent : MachineEventUnit<string>
  12. {
  13. protected override string hookName => EventHooks.UnityEvent;
  14. /// <summary>
  15. /// The name of the event. The event will only trigger if this value
  16. /// is equal to the string parameter passed in the UnityEvent.
  17. /// </summary>
  18. [DoNotSerialize]
  19. [PortLabelHidden]
  20. public ValueInput name { get; private set; }
  21. protected override void Definition()
  22. {
  23. base.Definition();
  24. name = ValueInput(nameof(name), string.Empty);
  25. }
  26. protected override bool ShouldTrigger(Flow flow, string name)
  27. {
  28. return CompareNames(flow, this.name, name);
  29. }
  30. }
  31. }