// Use this for initialization
    void Start()
    {
        transform.name   = "ParticleEmitter_" + (int)Time.time;
        m_ParticleStatus = PARTICLE_STATUS.PARTICLE_STATUS_SHOW;

        fSecStart = 0;
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        transform.name = "ParticleEmitter_"+ (int)Time.time;
        m_ParticleStatus = PARTICLE_STATUS.PARTICLE_STATUS_SHOW;
        //mShowSecond = 5;

        fSecStart = Time.time;
        fSecNow =fSecStart;
    }
    // Update is called once per frame
    void Update()
    {
        fSecStart += Time.deltaTime;

        if (fSecStart > m_TimeToKeep)
        {
            m_ParticleStatus = PARTICLE_STATUS.PARTICLE_STATUS_STOP;
        }

        if (fSecStart > m_TimeToKill)
        {
            m_ParticleStatus = PARTICLE_STATUS.PARTICLE_STATUS_DESTROY;
        }


        if (m_ParticleStatus == PARTICLE_STATUS.PARTICLE_STATUS_STOP)
        {
            ParticleSystem ps = transform.GetComponent <ParticleSystem> ();
            if (ps)
            {
                ps.enableEmission = false;
            }

            foreach (Transform child in transform)
            {
                ps = child.GetComponent <ParticleSystem> ();
                if (ps)
                {
                    ps.enableEmission = false;
                }
            }
        }

        if (m_ParticleStatus == PARTICLE_STATUS.PARTICLE_STATUS_DESTROY)
        {
            //Destroy( this.gameObject , 3.0f);
            Destroy(this.gameObject);
        }
    }
Exemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        fSecStart = Time.time;

        int nTimeDiff = (int)(fSecStart - fSecNow);
        //Debug.Log("time:"+nTimeDiff);
        if(  nTimeDiff  > 1)
            m_ParticleStatus = PARTICLE_STATUS.PARTICLE_STATUS_STOP;

        if(  nTimeDiff  > 5)
            m_ParticleStatus = PARTICLE_STATUS.PARTICLE_STATUS_DESTROY;

        if (m_ParticleStatus == PARTICLE_STATUS.PARTICLE_STATUS_STOP)
        {
            //Emitter.GetComponent<ParticleEmitter>().enabled = false;
            transform.GetComponent<ParticleEmitter>().emit= false;
        }

        if (m_ParticleStatus == PARTICLE_STATUS.PARTICLE_STATUS_DESTROY)
        {
            //Destroy( this.gameObject , 3.0f);
            Destroy( this.gameObject );
        }
    }