using System;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.VisualScripting
{
///
/// A special named event with any amount of parameters called manually with the 'Trigger Custom Event' unit.
///
[UnitCategory("Events")]
[UnitOrder(0)]
public sealed class CustomEvent : GameObjectEventUnit
{
public override Type MessageListenerType => null;
protected override string hookName => EventHooks.Custom;
[SerializeAs(nameof(argumentCount))]
private int _argumentCount;
[DoNotSerialize]
[Inspectable, UnitHeaderInspectable("Arguments")]
public int argumentCount
{
get => _argumentCount;
set => _argumentCount = Mathf.Clamp(value, 0, 10);
}
///
/// The name of the event.
///
[DoNotSerialize]
[PortLabelHidden]
public ValueInput name { get; private set; }
[DoNotSerialize]
public List argumentPorts { get; } = new List();
protected override void Definition()
{
base.Definition();
name = ValueInput(nameof(name), string.Empty);
argumentPorts.Clear();
for (var i = 0; i < argumentCount; i++)
{
argumentPorts.Add(ValueOutput