private void InitAnimation() { if (this.m_Transform != null) { return; } this.m_fElapsedRate = 0f; this.m_Transform = base.transform; foreach (NcCurveAnimation.NcInfoCurve current in this.m_CurveInfoList) { if (current.m_bEnabled) { switch (current.m_ApplyType) { case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.POSITION: current.m_OriginalValue = Vector4.zero; current.m_BeforeValue = current.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.ROTATION: current.m_OriginalValue = Vector4.zero; current.m_BeforeValue = current.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE: current.m_OriginalValue = this.m_Transform.localScale; current.m_BeforeValue = current.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MATERIAL_COLOR: if (current.m_bRecursively) { if (this.m_ChildRenderers == null) { this.m_ChildRenderers = base.transform.GetComponentsInChildren <Renderer>(true); this.m_ChildColorNames = new string[this.m_ChildRenderers.Length]; } current.m_ChildOriginalColorValues = new Vector4[this.m_ChildRenderers.Length]; current.m_ChildBeforeColorValues = new Vector4[this.m_ChildRenderers.Length]; for (int i = 0; i < this.m_ChildRenderers.Length; i++) { Renderer renderer = this.m_ChildRenderers[i]; this.m_ChildColorNames[i] = NcCurveAnimation.Ng_GetMaterialColorName(renderer.sharedMaterial); if (this.m_ChildColorNames[i] != null) { if (!this.m_bSavedOriginalValue) { current.m_ChildOriginalColorValues[i] = renderer.material.GetColor(this.m_ChildColorNames[i]); } else { renderer.material.SetColor(this.m_ChildColorNames[i], current.m_ChildOriginalColorValues[i]); } } current.m_ChildBeforeColorValues[i] = Vector4.zero; } } else if (base.renderer != null) { this.m_ColorName = NcCurveAnimation.Ng_GetMaterialColorName(base.renderer.sharedMaterial); if (this.m_ColorName != null) { if (!this.m_bSavedOriginalValue) { current.m_OriginalValue = base.renderer.material.GetColor(this.m_ColorName); } else { base.renderer.material.SetColor(this.m_ColorName, current.m_OriginalValue); } } current.m_BeforeValue = Vector4.zero; } break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.TEXTUREUV: if (this.m_NcUvAnimation == null) { this.m_NcUvAnimation = base.GetComponent <NcUvAnimation>(); } if (this.m_NcUvAnimation != null) { if (!this.m_bSavedOriginalValue) { current.m_OriginalValue = new Vector4(this.m_NcUvAnimation.m_fScrollSpeedX, this.m_NcUvAnimation.m_fScrollSpeedY, 0f, 0f); } else { this.m_NcUvAnimation.m_fScrollSpeedX = current.m_OriginalValue.x; this.m_NcUvAnimation.m_fScrollSpeedY = current.m_OriginalValue.y; } } current.m_BeforeValue = current.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MESH_COLOR: { float t = current.m_AniCurve.Evaluate(0f); Color tarColor = Color.Lerp(current.m_FromColor, current.m_ToColor, t); if (current.m_bRecursively) { this.m_ChildMeshFilters = base.transform.GetComponentsInChildren <MeshFilter>(true); if (this.m_ChildMeshFilters != null && this.m_ChildMeshFilters.Length >= 0) { for (int j = 0; j < this.m_ChildMeshFilters.Length; j++) { this.ChangeMeshColor(this.m_ChildMeshFilters[j], tarColor); } } } else { this.m_MainMeshFilter = base.GetComponent <MeshFilter>(); this.ChangeMeshColor(this.m_MainMeshFilter, tarColor); } break; } } } } this.m_bSavedOriginalValue = true; }
private void InitAnimation() { this.m_fElapsedRate = 0f; this.m_Transform = base.transform; this.m_TransformScale = this.m_Transform.localScale; this.m_TransformLocalPosition = this.m_Transform.localPosition; this.m_TransformLocalRotation = this.m_Transform.localRotation; int count = this.m_CurveInfoList.Count; for (int i = 0; i < count; i++) { NcCurveAnimation.NcInfoCurve ncInfoCurve = this.m_CurveInfoList[i]; if (ncInfoCurve.m_bEnabled) { switch (ncInfoCurve.m_ApplyType) { case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.POSITION: ncInfoCurve.m_OriginalValue = Vector4.zero; ncInfoCurve.m_BeforeValue = ncInfoCurve.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.ROTATION: ncInfoCurve.m_OriginalValue = Vector4.zero; ncInfoCurve.m_BeforeValue = ncInfoCurve.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE: ncInfoCurve.m_OriginalValue = this.m_Transform.localScale; ncInfoCurve.m_BeforeValue = ncInfoCurve.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.COLOR: if (ncInfoCurve.m_bRecursively) { this.m_ChildRenderers = base.transform.GetComponentsInChildren <Renderer>(true); this.m_ChildColorNames = new string[this.m_ChildRenderers.Length]; ncInfoCurve.m_ChildOriginalColorValues = new Vector4[this.m_ChildRenderers.Length]; ncInfoCurve.m_ChildBeforeColorValues = new Vector4[this.m_ChildRenderers.Length]; for (int j = 0; j < this.m_ChildRenderers.Length; j++) { Renderer renderer = this.m_ChildRenderers[j]; this.m_ChildColorNames[j] = NcCurveAnimation.Ng_GetMaterialColorName(renderer.material); if (this.m_ChildColorNames[j] != null) { ncInfoCurve.m_ChildOriginalColorValues[j] = renderer.material.GetColor(this.m_ChildColorNames[j]); } ncInfoCurve.m_ChildBeforeColorValues[j] = Vector4.zero; } } else if (this.thisRenderer != null) { this.m_ColorName = NcCurveAnimation.Ng_GetMaterialColorName(this.thisRenderer.sharedMaterial); if (this.m_ColorName != null) { ncInfoCurve.m_OriginalValue = this.thisRenderer.sharedMaterial.GetColor(this.m_ColorName); } ncInfoCurve.m_BeforeValue = Vector4.zero; } break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.TEXTUREUV: if (this.m_NcUvAnimation == null) { this.m_NcUvAnimation = base.GetComponent <NcUvAnimation>(); } if (this.m_NcUvAnimation) { ncInfoCurve.m_OriginalValue = new Vector4(this.m_NcUvAnimation.m_fScrollSpeedX, this.m_NcUvAnimation.m_fScrollSpeedY, 0f, 0f); } ncInfoCurve.m_BeforeValue = ncInfoCurve.m_OriginalValue; break; } } } }
private void InitAnimation() { this.m_fElapsedRate = 0f; this.m_Transform = base.get_transform(); using (List <NcCurveAnimation.NcInfoCurve> .Enumerator enumerator = this.m_CurveInfoList.GetEnumerator()) { while (enumerator.MoveNext()) { NcCurveAnimation.NcInfoCurve current = enumerator.get_Current(); if (current.m_bEnabled) { switch (current.m_ApplyType) { case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.POSITION: current.m_OriginalValue = Vector4.get_zero(); current.m_BeforeValue = current.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.ROTATION: current.m_OriginalValue = Vector4.get_zero(); current.m_BeforeValue = current.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE: current.m_OriginalValue = this.m_Transform.get_localScale(); current.m_BeforeValue = current.m_OriginalValue; break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.COLOR: if (current.m_bRecursively) { this.m_ChildRenderers = base.get_transform().GetComponentsInChildren <Renderer>(true); this.m_ChildColorNames = new string[this.m_ChildRenderers.Length]; current.m_ChildOriginalColorValues = new Vector4[this.m_ChildRenderers.Length]; current.m_ChildBeforeColorValues = new Vector4[this.m_ChildRenderers.Length]; for (int i = 0; i < this.m_ChildRenderers.Length; i++) { Renderer renderer = this.m_ChildRenderers[i]; this.m_ChildColorNames[i] = NcCurveAnimation.Ng_GetMaterialColorName(renderer.get_material()); if (this.m_ChildColorNames[i] != null) { current.m_ChildOriginalColorValues[i] = renderer.get_material().GetColor(this.m_ChildColorNames[i]); } current.m_ChildBeforeColorValues[i] = Vector4.get_zero(); } } else if (base.GetComponent <Renderer>() != null) { this.m_ColorName = NcCurveAnimation.Ng_GetMaterialColorName(base.GetComponent <Renderer>().get_sharedMaterial()); if (this.m_ColorName != null) { current.m_OriginalValue = base.GetComponent <Renderer>().get_sharedMaterial().GetColor(this.m_ColorName); } current.m_BeforeValue = Vector4.get_zero(); } break; case NcCurveAnimation.NcInfoCurve.APPLY_TYPE.TEXTUREUV: if (this.m_NcUvAnimation == null) { this.m_NcUvAnimation = base.GetComponent <NcUvAnimation>(); } if (this.m_NcUvAnimation) { current.m_OriginalValue = new Vector4(this.m_NcUvAnimation.m_fScrollSpeedX, this.m_NcUvAnimation.m_fScrollSpeedY, 0f, 0f); } current.m_BeforeValue = current.m_OriginalValue; break; } } } } }