using System.ComponentModel; using UnityEngine; using UnityObject = UnityEngine.Object; namespace Unity.VisualScripting { #if MODULE_ANIMATION_EXISTS /// /// Called when an animation event points to TriggerAnimationEvent. /// [UnitCategory("Events/Animation")] [UnitShortTitle("Animation Event")] [UnitTitle("Animation Event")] [TypeIcon(typeof(AnimationClip))] [DisplayName("Visual Scripting Animation Event")] public sealed class BoltAnimationEvent : MachineEventUnit { protected override string hookName => EventHooks.AnimationEvent; /// /// The string parameter passed to the event. /// [DoNotSerialize] [PortLabel("String")] public ValueOutput stringParameter { get; private set; } /// /// The float parameter passed to the event. /// [DoNotSerialize] [PortLabel("Float")] public ValueOutput floatParameter { get; private set; } /// /// The integer parameter passed to the function. /// [DoNotSerialize] [PortLabel("Integer")] public ValueOutput intParameter { get; private set; } /// /// The Unity object parameter passed to the function. /// [DoNotSerialize] [PortLabel("Object")] public ValueOutput objectReferenceParameter { get; private set; } protected override void Definition() { base.Definition(); stringParameter = ValueOutput(nameof(stringParameter)); floatParameter = ValueOutput(nameof(floatParameter)); intParameter = ValueOutput(nameof(intParameter)); objectReferenceParameter = ValueOutput(nameof(objectReferenceParameter)); } protected override void AssignArguments(Flow flow, AnimationEvent args) { flow.SetValue(stringParameter, args.stringParameter); flow.SetValue(floatParameter, args.floatParameter); flow.SetValue(intParameter, args.intParameter); flow.SetValue(objectReferenceParameter, args.objectReferenceParameter); } } #endif }