上海东方渔人码头电子沙盘单机版
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.
 
 
 
 

36 lines
854 B

using UnityEngine;
using System.Collections;
[RequireComponent(typeof(ParticleSystem))]
public class CFX_AutoDestructShuriken : MonoBehaviour
{
public bool OnlyDeactivate;
void OnEnable()
{
StartCoroutine("CheckIfAlive");
}
IEnumerator CheckIfAlive()
{
while (true)
{
yield return new WaitForSeconds(0.5f);
if (!GetComponent<ParticleSystem>().IsAlive(true))
{
if (OnlyDeactivate)
{
#if UNITY_3_5
this.gameObject.SetActiveRecursively(false);
#else
this.gameObject.SetActive(false);
#endif
}
else
//GameObject.Destroy(this.gameObject);
EntitiesManager.Instance.DeleteObj(gameObject);
break;
}
}
}
}