You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
712 B
40 lines
712 B
3 years ago
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class ParticleController : MonoBehaviour
|
||
|
{
|
||
|
public Action OnParticleEnd;
|
||
|
|
||
|
public ParticleSystem ParticleSys;
|
||
|
|
||
|
void Awake()
|
||
|
{
|
||
|
ParticleSys = GetComponent<ParticleSystem>();
|
||
|
var main = ParticleSys.main;
|
||
|
main.stopAction = ParticleSystemStopAction.Callback;
|
||
|
}
|
||
|
|
||
|
public void Play()
|
||
|
{
|
||
|
this.ParticleSys.Play();
|
||
|
}
|
||
|
|
||
|
public void Stop()
|
||
|
{
|
||
|
this.ParticleSys.Stop();
|
||
|
}
|
||
|
|
||
|
public void Pause()
|
||
|
{
|
||
|
this.ParticleSys.Pause();
|
||
|
}
|
||
|
|
||
|
|
||
|
public void OnParticleSystemStopped()
|
||
|
{
|
||
|
this.OnParticleEnd?.Invoke();
|
||
|
}
|
||
|
}
|