29 lines
649 B
C#
29 lines
649 B
C#
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
public class TreeParticleEffect : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
public ParticleSystem collisionParticleSystem;
|
||
|
|
||
|
private void OnTriggerEnter2D(Collider2D collision)
|
||
|
{
|
||
|
if (collision.tag == "AttackHitbox")
|
||
|
{
|
||
|
var em = collisionParticleSystem.emission;
|
||
|
em.enabled = true;
|
||
|
collisionParticleSystem.Play();
|
||
|
StartCoroutine(Timer());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
IEnumerator Timer()
|
||
|
{
|
||
|
yield return new WaitForSeconds(2.5f);
|
||
|
var em = collisionParticleSystem.emission;
|
||
|
em.enabled = false;
|
||
|
}
|
||
|
}
|
||
|
|