Exemplo n.º 1
0
    void CreateEffect()
    {
        Debug.Log("creating effect");
        if (_hasLocation)
        {
            _go = EffectsManager.CreateEffect(_name, _loc, _rot);
        }
        else
        {
            _go = EffectsManager.CreateEffect(_name);
        }
        if (_hasParent)
        {
            _go.transform.parent = _parent;
        }
        if (_go == null)
        {
            return;
        }
        ParticleSystem _goPs = _go.GetComponent <ParticleSystem>();

        if (_goPs != null)
        {
            _particles.Add(_goPs);
        }
        _particles.AddRange(_go.GetComponentsInChildren <ParticleSystem>());
        foreach (ParticleSystem _ps in _particles)
        {
            _ps.randomSeed    = _seed;
            _ps.playbackSpeed = EffectsManager.PlaySpeed;
        }
        EffectsManager.RegisterEffect(this);
        for (int i = 0; i < _particles.Count; i++)
        {
            _particles[i].Stop();
        }
        Debug.Log("Created effect " + _particles.Count);
    }