Beispiel #1
0
 public void ReadChildData(BinaryReader reader)
 {
     for (int x = 0; x < _physicsConstants.Count; x++)
     {
         PhysicsConstants.AddNew();
         PhysicsConstants[x].Read(reader);
     }
     for (int x = 0; x < _physicsConstants.Count; x++)
     {
         PhysicsConstants[x].ReadChildData(reader);
     }
     for (int x = 0; x < _states.Count; x++)
     {
         States.AddNew();
         States[x].Read(reader);
     }
     for (int x = 0; x < _states.Count; x++)
     {
         States[x].ReadChildData(reader);
     }
     for (int x = 0; x < _particleStates.Count; x++)
     {
         ParticleStates.AddNew();
         ParticleStates[x].Read(reader);
     }
     for (int x = 0; x < _particleStates.Count; x++)
     {
         ParticleStates[x].ReadChildData(reader);
     }
 }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        timer -= Time.deltaTime;

        switch (state)
        {
        case ParticleStates.UP:
            if (timer > 0)
            {
                _sr.color = new Color(_sr.color.r, _sr.color.g, _sr.color.b, 1 - timer / upTime);
            }
            else
            {
                state = ParticleStates.DOWN; timer = downTime;
            }
            break;

        case ParticleStates.DOWN:
            if (timer > 0)
            {
                _sr.color = new Color(_sr.color.r, _sr.color.g, _sr.color.b, timer / downTime);
            }
            else
            {
                state = ParticleStates.END; timer = downTime;
            }
            break;

        case ParticleStates.END:
            Destroy();
            break;
        }
    }
            public virtual void ReadChildData(BinaryReader reader)
            {
                int x = 0;

                for (x = 0; (x < _physicsConstants.Count); x = (x + 1))
                {
                    PhysicsConstants.Add(new ParticleSystemPhysicsConstantsBlock());
                    PhysicsConstants[x].Read(reader);
                }
                for (x = 0; (x < _physicsConstants.Count); x = (x + 1))
                {
                    PhysicsConstants[x].ReadChildData(reader);
                }
                for (x = 0; (x < _states.Count); x = (x + 1))
                {
                    States.Add(new ParticleSystemTypeStatesBlock());
                    States[x].Read(reader);
                }
                for (x = 0; (x < _states.Count); x = (x + 1))
                {
                    States[x].ReadChildData(reader);
                }
                for (x = 0; (x < _particleStates.Count); x = (x + 1))
                {
                    ParticleStates.Add(new ParticleSystemTypeParticleStatesBlock());
                    ParticleStates[x].Read(reader);
                }
                for (x = 0; (x < _particleStates.Count); x = (x + 1))
                {
                    ParticleStates[x].ReadChildData(reader);
                }
            }
Beispiel #4
0
    private void OnEnable()
    {
        state = ParticleStates.UP;
        timer = upTime;
        if (!_sr)
        {
            _sr = GetComponent <SpriteRenderer>();
        }
        _sr.color = new Color(_sr.color.r, _sr.color.g, _sr.color.b, 1 - timer / upTime);

        if (_as)
        {
            _as.time  = 0;
            _as.pitch = 0.75F + 0.5F * Random.value;
            //_as.volume = 0.85F + 0.3F * Random.value;
            _as.Play();
        }
    }