Beispiel #1
0
 private void Update()
 {
     if (0f < this.m_fStartDestroyTime)
     {
         if (0f < this.m_fSmoothDestroyTime)
         {
             if (this.m_bSmoothHide)
             {
                 float num = 1f - (NcEffectBehaviour.GetEngineTime() - this.m_fStartDestroyTime) / this.m_fSmoothDestroyTime;
                 if (num < 0f)
                 {
                     num = 0f;
                 }
                 Renderer[] componentsInChildren = base.transform.GetComponentsInChildren <Renderer>(true);
                 for (int i = 0; i < componentsInChildren.Length; i++)
                 {
                     Renderer renderer          = componentsInChildren[i];
                     string   materialColorName = NcEffectBehaviour.GetMaterialColorName(renderer.material);
                     if (materialColorName != null)
                     {
                         Color color = renderer.material.GetColor(materialColorName);
                         color.a = Mathf.Min(num, color.a);
                         renderer.material.SetColor(materialColorName, color);
                     }
                 }
             }
             if (this.m_fStartDestroyTime + this.m_fSmoothDestroyTime < NcEffectBehaviour.GetEngineTime())
             {
                 this.AutoDestruct();
             }
         }
     }
     else
     {
         if (0f < this.m_fStartTime && this.m_fStartTime + this.m_fLifeTime <= NcEffectBehaviour.GetEngineTime())
         {
             this.StartDestroy();
         }
         if (this.m_bEndNcCurveAnimation && this.m_NcCurveAnimation != null && 1f <= this.m_NcCurveAnimation.GetElapsedRate())
         {
             this.StartDestroy();
         }
     }
 }
 private void Update()
 {
     if (!this.m_bStartDetach)
     {
         this.m_bStartDetach = true;
         if (base.transform.parent != null)
         {
             this.m_ParentGameObject = base.transform.parent.gameObject;
             this.m_ncDetachObject   = NcDetachObject.Create(this.m_ParentGameObject, base.transform.gameObject);
         }
         GameObject rootInstanceEffect = NcEffectBehaviour.GetRootInstanceEffect();
         if (this.m_bFollowParentTransform)
         {
             this.m_OriginalPos.SetLocalTransform(base.transform);
             base.ChangeParent(rootInstanceEffect.transform, base.transform, false, null);
             this.m_OriginalPos.CopyToLocalTransform(base.transform);
         }
         else
         {
             base.ChangeParent(rootInstanceEffect.transform, base.transform, false, null);
         }
         if (!this.m_bParentHideToStartDestroy)
         {
             this.StartDestroy();
         }
     }
     if (0f < this.m_fStartDestroyTime)
     {
         if (0f < this.m_fSmoothDestroyTime)
         {
             if (this.m_bSmoothHide)
             {
                 float num = 1f - (NcEffectBehaviour.GetEngineTime() - this.m_fStartDestroyTime) / this.m_fSmoothDestroyTime;
                 if (num < 0f)
                 {
                     num = 0f;
                 }
                 if (this.m_bMeshFilterOnlySmoothHide)
                 {
                     MeshFilter[] componentsInChildren = base.transform.GetComponentsInChildren <MeshFilter>(true);
                     for (int i = 0; i < componentsInChildren.Length; i++)
                     {
                         Color[] array = componentsInChildren[i].mesh.colors;
                         if (array.Length == 0)
                         {
                             array = new Color[componentsInChildren[i].mesh.vertices.Length];
                             for (int j = 0; j < array.Length; j++)
                             {
                                 array[j] = Color.white;
                             }
                         }
                         for (int k = 0; k < array.Length; k++)
                         {
                             Color color = array[k];
                             color.a  = Mathf.Min(color.a, num);
                             array[k] = color;
                         }
                         componentsInChildren[i].mesh.colors = array;
                     }
                 }
                 else
                 {
                     Renderer[] componentsInChildren2 = base.transform.GetComponentsInChildren <Renderer>(true);
                     for (int l = 0; l < componentsInChildren2.Length; l++)
                     {
                         Renderer renderer          = componentsInChildren2[l];
                         string   materialColorName = NcEffectBehaviour.GetMaterialColorName(renderer.sharedMaterial);
                         if (materialColorName != null)
                         {
                             Color color2 = renderer.material.GetColor(materialColorName);
                             color2.a = Mathf.Min(color2.a, num);
                             renderer.material.SetColor(materialColorName, color2);
                         }
                     }
                 }
             }
             if (this.m_fStartDestroyTime + this.m_fSmoothDestroyTime < NcEffectBehaviour.GetEngineTime())
             {
                 UnityEngine.Object.Destroy(base.gameObject);
             }
         }
     }
     else if (this.m_bParentHideToStartDestroy && (this.m_ParentGameObject == null || !NcEffectBehaviour.IsActive(this.m_ParentGameObject)))
     {
         this.StartDestroy();
     }
     if (this.m_bFollowParentTransform && this.m_ParentGameObject != null && this.m_ParentGameObject.transform != null)
     {
         NcTransformTool ncTransformTool = new NcTransformTool();
         ncTransformTool.SetTransform(this.m_OriginalPos);
         ncTransformTool.AddTransform(this.m_ParentGameObject.transform);
         ncTransformTool.CopyToLocalTransform(base.transform);
     }
 }
 private void Update()
 {
     if (0f < this.m_fStartDestroyTime)
     {
         if (0f < this.m_fSmoothDestroyTime)
         {
             if (this.m_bSmoothHide)
             {
                 float num = 1f - (NcEffectBehaviour.GetEngineTime() - this.m_fStartDestroyTime) / this.m_fSmoothDestroyTime;
                 if (num < 0f)
                 {
                     num = 0f;
                 }
                 if (this.m_bMeshFilterOnlySmoothHide)
                 {
                     MeshFilter[] componentsInChildren = base.transform.GetComponentsInChildren <MeshFilter>(true);
                     for (int i = 0; i < componentsInChildren.Length; i++)
                     {
                         Color[] array = componentsInChildren[i].mesh.colors;
                         if (array.Length == 0)
                         {
                             array = new Color[componentsInChildren[i].mesh.vertices.Length];
                             for (int j = 0; j < array.Length; j++)
                             {
                                 array[j] = Color.white;
                             }
                         }
                         for (int k = 0; k < array.Length; k++)
                         {
                             Color color = array[k];
                             color.a  = Mathf.Min(color.a, num);
                             array[k] = color;
                         }
                         componentsInChildren[i].mesh.colors = array;
                     }
                 }
                 else
                 {
                     Renderer[] componentsInChildren2 = base.transform.GetComponentsInChildren <Renderer>(true);
                     for (int l = 0; l < componentsInChildren2.Length; l++)
                     {
                         Renderer renderer          = componentsInChildren2[l];
                         string   materialColorName = NcEffectBehaviour.GetMaterialColorName(renderer.sharedMaterial);
                         if (materialColorName != null)
                         {
                             Color color2 = renderer.material.GetColor(materialColorName);
                             color2.a = Mathf.Min(color2.a, num);
                             renderer.material.SetColor(materialColorName, color2);
                         }
                     }
                 }
             }
             if (this.m_fStartDestroyTime + this.m_fSmoothDestroyTime < NcEffectBehaviour.GetEngineTime())
             {
                 this.AutoDeactive();
             }
         }
     }
     else
     {
         if (0f < this.m_fStartTime && this.m_fStartTime + this.m_fLifeTime <= NcEffectBehaviour.GetEngineTime())
         {
             this.StartDeactive();
         }
         if (this.m_bEndNcCurveAnimation && this.m_NcCurveAnimation != null && 1f <= this.m_NcCurveAnimation.GetElapsedRate())
         {
             this.StartDeactive();
         }
     }
 }
Beispiel #4
0
 private void Update()
 {
     if (!this.m_bStartDetach)
     {
         this.m_bStartDetach = true;
         if (base.transform.parent != null)
         {
             this.m_ParentGameObject = base.transform.parent.gameObject;
             NcDetachObject.Create(this.m_ParentGameObject, base.transform.gameObject);
         }
         GameObject rootInstanceEffect = NcEffectBehaviour.GetRootInstanceEffect();
         if (this.m_bFollowParentTransform)
         {
             this.m_OriginalPos.SetLocalTransform(base.transform);
             base.ChangeParent(rootInstanceEffect.transform, base.transform, false, null);
             this.m_OriginalPos.CopyToLocalTransform(base.transform);
         }
         else
         {
             base.ChangeParent(rootInstanceEffect.transform, base.transform, false, null);
         }
         if (!this.m_bParentHideToStartDestroy)
         {
             this.StartDestroy();
         }
     }
     if (0f < this.m_fStartDestroyTime)
     {
         if (0f < this.m_fSmoothDestroyTime)
         {
             if (this.m_bSmoothHide)
             {
                 float num = 1f - (NcEffectBehaviour.GetEngineTime() - this.m_fStartDestroyTime) / this.m_fSmoothDestroyTime;
                 if (num < 0f)
                 {
                     num = 0f;
                 }
                 Renderer[] componentsInChildren = base.transform.GetComponentsInChildren <Renderer>(true);
                 for (int i = 0; i < componentsInChildren.Length; i++)
                 {
                     Renderer renderer          = componentsInChildren[i];
                     string   materialColorName = NcEffectBehaviour.GetMaterialColorName(renderer.material);
                     if (materialColorName != null)
                     {
                         Color color = renderer.material.GetColor(materialColorName);
                         color.a = Mathf.Min(num, color.a);
                         renderer.material.SetColor(materialColorName, color);
                     }
                 }
             }
             if (this.m_fStartDestroyTime + this.m_fSmoothDestroyTime < NcEffectBehaviour.GetEngineTime())
             {
                 DelegateProxy.GameDestory(base.gameObject);
             }
         }
     }
     else if (this.m_bParentHideToStartDestroy && (this.m_ParentGameObject == null || !NcEffectBehaviour.IsActive(this.m_ParentGameObject)))
     {
         this.StartDestroy();
     }
     if (this.m_bFollowParentTransform && this.m_ParentGameObject != null && this.m_ParentGameObject.transform != null)
     {
         NcTransformTool ncTransformTool = new NcTransformTool();
         ncTransformTool.SetTransform(this.m_OriginalPos);
         ncTransformTool.AddTransform(this.m_ParentGameObject.transform);
         ncTransformTool.CopyToLocalTransform(base.transform);
     }
 }
Beispiel #5
0
 private void Update()
 {
     if (!this.m_bStartDetach)
     {
         this.m_bStartDetach = true;
         if (base.get_transform().get_parent() != null)
         {
             this.m_ParentGameObject = base.get_transform().get_parent().get_gameObject();
             NcDetachObject.Create(this.m_ParentGameObject, base.get_transform().get_gameObject());
         }
         GameObject rootInstanceEffect = NcEffectBehaviour.GetRootInstanceEffect();
         if (this.m_bFollowParentTransform)
         {
             this.m_OriginalPos.SetLocalTransform(base.get_transform());
             base.ChangeParent(rootInstanceEffect.get_transform(), base.get_transform(), false, null);
             this.m_OriginalPos.CopyToLocalTransform(base.get_transform());
         }
         else
         {
             base.ChangeParent(rootInstanceEffect.get_transform(), base.get_transform(), false, null);
         }
         if (!this.m_bParentHideToStartDestroy)
         {
             this.StartDestroy();
         }
     }
     if (0f < this.m_fStartDestroyTime)
     {
         if (0f < this.m_fSmoothDestroyTime)
         {
             if (this.m_bSmoothHide)
             {
                 float num = 1f - (NcEffectBehaviour.GetEngineTime() - this.m_fStartDestroyTime) / this.m_fSmoothDestroyTime;
                 if (num < 0f)
                 {
                     num = 0f;
                 }
                 if (this.m_bMeshFilterOnlySmoothHide)
                 {
                     MeshFilter[] componentsInChildren = base.get_transform().GetComponentsInChildren <MeshFilter>(true);
                     for (int i = 0; i < componentsInChildren.Length; i++)
                     {
                         Color[] colors = componentsInChildren[i].get_mesh().get_colors();
                         for (int j = 0; j < colors.Length; j++)
                         {
                             Color color = colors[j];
                             color.a  -= num;
                             colors[j] = color;
                         }
                         componentsInChildren[i].get_mesh().set_colors(colors);
                     }
                 }
                 else
                 {
                     Renderer[] componentsInChildren2 = base.get_transform().GetComponentsInChildren <Renderer>(true);
                     for (int k = 0; k < componentsInChildren2.Length; k++)
                     {
                         Renderer renderer          = componentsInChildren2[k];
                         string   materialColorName = NcEffectBehaviour.GetMaterialColorName(renderer.get_material());
                         if (materialColorName != null)
                         {
                             Color color2 = renderer.get_material().GetColor(materialColorName);
                             color2.a -= num;
                             renderer.get_material().SetColor(materialColorName, color2);
                         }
                     }
                 }
             }
             if (this.m_fStartDestroyTime + this.m_fSmoothDestroyTime < NcEffectBehaviour.GetEngineTime())
             {
                 Object.Destroy(base.get_gameObject());
             }
         }
     }
     else if (this.m_bParentHideToStartDestroy && (this.m_ParentGameObject == null || !NcEffectBehaviour.IsActive(this.m_ParentGameObject)))
     {
         this.StartDestroy();
     }
     if (this.m_bFollowParentTransform && this.m_ParentGameObject != null && this.m_ParentGameObject.get_transform() != null)
     {
         NcTransformTool ncTransformTool = new NcTransformTool();
         ncTransformTool.SetTransform(this.m_OriginalPos);
         ncTransformTool.AddTransform(this.m_ParentGameObject.get_transform());
         ncTransformTool.CopyToLocalTransform(base.get_transform());
     }
 }
    private void ChangeToAlpha(float fElapsedRate)
    {
        float num = Mathf.Lerp(this.m_fFromAlphaValue, this.m_fToMeshValue, fElapsedRate);

        if (this.m_TargetType == NcChangeAlpha.TARGET_TYPE.MeshColor)
        {
            MeshFilter[] array;
            if (this.m_bRecursively)
            {
                array = base.transform.GetComponentsInChildren <MeshFilter>(true);
            }
            else
            {
                array = base.transform.GetComponents <MeshFilter>();
            }
            for (int i = 0; i < array.Length; i++)
            {
                Color[] array2 = array[i].mesh.colors;
                if (array2.Length == 0)
                {
                    if (array[i].mesh.vertices.Length == 0)
                    {
                        NcSpriteFactory.CreateEmptyMesh(array[i]);
                    }
                    array2 = new Color[array[i].mesh.vertices.Length];
                    for (int j = 0; j < array2.Length; j++)
                    {
                        array2[j] = Color.white;
                    }
                }
                for (int k = 0; k < array2.Length; k++)
                {
                    Color color = array2[k];
                    color.a   = num;
                    array2[k] = color;
                }
                array[i].mesh.colors = array2;
            }
        }
        else
        {
            Renderer[] array3;
            if (this.m_bRecursively)
            {
                array3 = base.transform.GetComponentsInChildren <Renderer>(true);
            }
            else
            {
                array3 = base.transform.GetComponents <Renderer>();
            }
            for (int l = 0; l < array3.Length; l++)
            {
                Renderer renderer          = array3[l];
                string   materialColorName = NcEffectBehaviour.GetMaterialColorName(renderer.sharedMaterial);
                if (materialColorName != null)
                {
                    Color color2 = renderer.material.GetColor(materialColorName);
                    color2.a = num;
                    renderer.material.SetColor(materialColorName, color2);
                }
            }
        }
        if (fElapsedRate == 1f && num == 0f)
        {
            NcEffectBehaviour.SetActiveRecursively(base.gameObject, false);
        }
    }
Beispiel #7
0
 private void Update()
 {
     if (0f < this.m_fStartDestroyTime)
     {
         if (0f < this.m_fSmoothDestroyTime)
         {
             if (this.m_bSmoothHide)
             {
                 float num = 1f - (NcEffectBehaviour.GetEngineTime() - this.m_fStartDestroyTime) / this.m_fSmoothDestroyTime;
                 if (num < 0f)
                 {
                     num = 0f;
                 }
                 if (this.m_bMeshFilterOnlySmoothHide)
                 {
                     MeshFilter[] componentsInChildren = base.get_transform().GetComponentsInChildren <MeshFilter>(true);
                     for (int i = 0; i < componentsInChildren.Length; i++)
                     {
                         Color[] colors = componentsInChildren[i].get_mesh().get_colors();
                         for (int j = 0; j < colors.Length; j++)
                         {
                             Color color = colors[j];
                             color.a  -= num;
                             colors[j] = color;
                         }
                         componentsInChildren[i].get_mesh().set_colors(colors);
                     }
                 }
                 else
                 {
                     Renderer[] componentsInChildren2 = base.get_transform().GetComponentsInChildren <Renderer>(true);
                     for (int k = 0; k < componentsInChildren2.Length; k++)
                     {
                         Renderer renderer          = componentsInChildren2[k];
                         string   materialColorName = NcEffectBehaviour.GetMaterialColorName(renderer.get_material());
                         if (materialColorName != null)
                         {
                             Color color2 = renderer.get_material().GetColor(materialColorName);
                             color2.a -= num;
                             renderer.get_material().SetColor(materialColorName, color2);
                         }
                     }
                 }
             }
             if (this.m_fStartDestroyTime + this.m_fSmoothDestroyTime < NcEffectBehaviour.GetEngineTime())
             {
                 this.AutoDestruct();
             }
         }
     }
     else
     {
         if (0f < this.m_fStartTime && this.m_fStartTime + this.m_fLifeTime <= NcEffectBehaviour.GetEngineTime())
         {
             this.StartDestroy();
         }
         if (this.m_bEndNcCurveAnimation && this.m_NcCurveAnimation != null && 1f <= this.m_NcCurveAnimation.GetElapsedRate())
         {
             this.StartDestroy();
         }
     }
 }