add ckg
plantilla base para movimiento básico
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class stopParticlesOnDisable : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public bool disableParticlesOnDisableEnabled = true;
|
||||
|
||||
public bool clearParticlesEnabled = true;
|
||||
|
||||
public ParticleSystem mainParticleSystem;
|
||||
|
||||
bool mainParticleSystemLocated;
|
||||
|
||||
|
||||
void OnDisable ()
|
||||
{
|
||||
if (disableParticlesOnDisableEnabled) {
|
||||
if (!mainParticleSystemLocated) {
|
||||
mainParticleSystemLocated = mainParticleSystem != null;
|
||||
|
||||
if (!mainParticleSystemLocated) {
|
||||
mainParticleSystem = GetComponentInChildren<ParticleSystem> ();
|
||||
|
||||
mainParticleSystemLocated = mainParticleSystem != null;
|
||||
}
|
||||
}
|
||||
|
||||
if (mainParticleSystemLocated) {
|
||||
mainParticleSystem.Stop ();
|
||||
|
||||
if (clearParticlesEnabled) {
|
||||
mainParticleSystem.Clear ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user