using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SlashAnim : MonoBehaviour
{
//Define particle system for the game
private ParticleSystem ps;
///
/// This method first runs when the game is first
/// awake and it gets the particle system component.
///
private void Awake(){
ps = GetComponent();
}
///
/// This method consistently updates the game,
/// checking if the particle system is working.
///
private void Update(){
//Check if condition is met
if(ps && !ps.IsAlive()){
//Destroy object (reference to method)
DestroySelf();
}
}
///
/// This method destroys the object.
///
public void DestroySelf(){
Destroy(gameObject);
}
}