Ejemplo n.º 1
0
    private void UpdateParticlesSpawn()
    {
        float num  = 1f - this.m_Curve.Evaluate((Time.time - this.m_StartTime) / this.m_Duration);
        float num2 = this.m_VerticesMinY + num * (this.m_VerticesMaxY - this.m_VerticesMinY);

        for (int i = 0; i < this.m_ParticleSpawnPos.Count; i++)
        {
            MiaDisappearEffectController.MiaDisappearEffectParticleSpawnPoint miaDisappearEffectParticleSpawnPoint = this.m_ParticleSpawnPos[i];
            if (!miaDisappearEffectParticleSpawnPoint.m_AlreadySpawned && miaDisappearEffectParticleSpawnPoint.m_Pos.y >= num2)
            {
                miaDisappearEffectParticleSpawnPoint.m_AlreadySpawned = true;
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_Prefab, miaDisappearEffectParticleSpawnPoint.m_Pos, Quaternion.identity);
                ParticlesManager.Get().Spawn(gameObject, miaDisappearEffectParticleSpawnPoint.m_Pos, Quaternion.identity, Vector3.zero, null, -1f, false);
                ParticleSystem.ColorOverLifetimeModule colorOverLifetime = gameObject.GetComponent <ParticleSystem>().colorOverLifetime;
                ParticleSystem.MinMaxGradient          color             = colorOverLifetime.color;
                if (color.gradient != null)
                {
                    GradientColorKey[] array  = new GradientColorKey[2];
                    GradientAlphaKey[] array2 = new GradientAlphaKey[2];
                    array[0].color  = miaDisappearEffectParticleSpawnPoint.m_Color;
                    array[0].time   = 0f;
                    array[1].color  = miaDisappearEffectParticleSpawnPoint.m_Color;
                    array[1].time   = 1f;
                    array2[0].alpha = 1f;
                    array2[0].time  = 0f;
                    array2[1].alpha = 0f;
                    array2[1].time  = 1f;
                    color.gradient.SetKeys(array, array2);
                }
                colorOverLifetime.color = color;
            }
        }
    }
Ejemplo n.º 2
0
 private void InitializeVerticesPosition()
 {
     if (this.m_MeshFilter == null || this.m_MeshFilter.mesh == null)
     {
         return;
     }
     this.m_ParticleSpawnPos.Clear();
     Vector3[] vertices = this.m_MeshFilter.mesh.vertices;
     Color[]   colors   = this.m_MeshFilter.mesh.colors;
     this.m_VerticesMaxY = float.MinValue;
     this.m_VerticesMinY = float.MaxValue;
     if (colors.Length != vertices.Length)
     {
         DebugUtils.Assert(DebugUtils.AssertType.Info);
         return;
     }
     for (int i = 0; i < vertices.Length; i += this.m_EveryNthVertex)
     {
         MiaDisappearEffectController.MiaDisappearEffectParticleSpawnPoint miaDisappearEffectParticleSpawnPoint = new MiaDisappearEffectController.MiaDisappearEffectParticleSpawnPoint();
         miaDisappearEffectParticleSpawnPoint.m_AlreadySpawned = false;
         miaDisappearEffectParticleSpawnPoint.m_Pos            = this.m_MeshFilter.gameObject.transform.TransformPoint(vertices[i]);
         miaDisappearEffectParticleSpawnPoint.m_Color          = colors[i];
         this.m_ParticleSpawnPos.Add(miaDisappearEffectParticleSpawnPoint);
         if (miaDisappearEffectParticleSpawnPoint.m_Pos.y > this.m_VerticesMaxY)
         {
             this.m_VerticesMaxY = miaDisappearEffectParticleSpawnPoint.m_Pos.y;
         }
         if (miaDisappearEffectParticleSpawnPoint.m_Pos.y < this.m_VerticesMinY)
         {
             this.m_VerticesMinY = miaDisappearEffectParticleSpawnPoint.m_Pos.y;
         }
     }
 }