using System;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.VisualScripting
{
#if MODULE_PARTICLE_SYSTEM_EXISTS
///
/// Called when a particle hits a collider.
///
[UnitCategory("Events/Physics")]
public sealed class OnParticleCollision : GameObjectEventUnit
{
public override Type MessageListenerType => typeof(UnityOnParticleCollisionMessageListener);
protected override string hookName => EventHooks.OnParticleCollision;
///
/// A game object with an attached collider struck by the particle system.
///
[DoNotSerialize]
public ValueOutput other { get; private set; }
///
/// The particle collision events.
///
[DoNotSerialize]
public ValueOutput collisionEvents { get; private set; }
protected override void Definition()
{
base.Definition();
other = ValueOutput(nameof(other));
collisionEvents = ValueOutput>(nameof(collisionEvents));
}
protected override void AssignArguments(Flow flow, GameObject other)
{
flow.SetValue(this.other, other);
var collisionEvents = new List();
var data = flow.stack.GetElementData(this);
data.target.GetComponent().GetCollisionEvents(other, collisionEvents);
flow.SetValue(this.collisionEvents, collisionEvents);
}
}
#endif
}