Files
2D-Plattformer-Example/Assets/Mod Assets/Mod Resources/Scripts/Platformer/EmitParticlesOnLand.cs
T
2026-04-30 00:53:30 +02:00

40 lines
895 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Reflection;
[RequireComponent(typeof(ParticleSystem))]
public class EmitParticlesOnLand : MonoBehaviour
{
public bool emitOnLand = true;
public bool emitOnEnemyDeath = true;
#if UNITY_TEMPLATE_PLATFORMER
ParticleSystem p;
void Start()
{
p = GetComponent<ParticleSystem>();
if (emitOnLand) {
Platformer.Gameplay.PlayerLanded.OnExecute += PlayerLanded_OnExecute;
void PlayerLanded_OnExecute(Platformer.Gameplay.PlayerLanded obj) {
p.Play();
}
}
if (emitOnEnemyDeath) {
Platformer.Gameplay.EnemyDeath.OnExecute += EnemyDeath_OnExecute;
void EnemyDeath_OnExecute(Platformer.Gameplay.EnemyDeath obj) {
p.Play();
}
}
}
#endif
}