Inheritance: MonoBehaviour
コード例 #1
0
    public static void Apply(GameObject rootObj)
    {
        PooledParticles pp = rootObj.AddComponent <PooledParticles>();

        foreach (var a in pp.animators)
        {
            var e = a.particleEmitter;
            if (!e)
            {
                continue;
            }

            if (e.emit)
            {
                pp.emitOnStart.Add(e);
            }

            if (a.autodestruct)
            {
                if (a.transform == rootObj.transform)
                {
                    pp.despawnOnAutoStop = true;
                }

                a.autodestruct = false;
                pp.autoStopEmitters.Add(e);
            }
        }
    }
コード例 #2
0
    private GameObject CreateNew(Vector3 position, Quaternion rotation)
    {
        GameObject obj = (GameObject)GameObject.Instantiate(prefab, position, rotation);

        if (obj.GetComponentInChildren <ParticleEmitter>() != null)
        {
            PooledParticles.Apply(obj);
        }

        return(obj);
    }
コード例 #3
0
 void Awake()
 {
     main = this;
 }