protected ArrayList InitAffectors(EffectNode node) { ArrayList AffectorList = new ArrayList(); if (UVAffectorEnable) { UVAnimation uvAnim = new UVAnimation(); Texture t = Vertexpool.GetMaterial().GetTexture("_MainTex"); if (UVType == 2) { uvAnim.BuildFromFile(EanPath, EanIndex, UVTime, t); OriLowerLeftUV = uvAnim.frames[0]; OriUVDimensions = uvAnim.UVDimensions[0]; } else if (UVType == 1) { float perWidth = t.width / Cols; float perHeight = t.height / Rows; Vector2 cellSize = new Vector2(perWidth / t.width, perHeight / t.height); Vector2 start = new Vector2(0f, 1f); uvAnim.BuildUVAnim(start, cellSize, Cols, Rows, Cols * Rows); OriLowerLeftUV = start; OriUVDimensions = cellSize; OriUVDimensions.y = -OriUVDimensions.y; } if (uvAnim.frames.Length == 1) { OriLowerLeftUV = uvAnim.frames[0]; OriUVDimensions = uvAnim.UVDimensions[0]; } else { uvAnim.loopCycles = LoopCircles; Affector aft = new UVAffector(uvAnim, UVTime, node); AffectorList.Add(aft); } } if (RotAffectorEnable && RotateType != RSTYPE.NONE) { Affector aft; if (RotateType == RSTYPE.CURVE) { aft = new RotateAffector(RotateCurve, node); } else { aft = new RotateAffector(DeltaRot, node); } AffectorList.Add(aft); } if (ScaleAffectorEnable && ScaleType != RSTYPE.NONE) { Affector aft; if (ScaleType == RSTYPE.CURVE) { aft = new ScaleAffector(ScaleXCurve, ScaleYCurve, node); } else { aft = new ScaleAffector(DeltaScaleX, DeltaScaleY, node); } AffectorList.Add(aft); } if (ColorAffectorEnable && ColorAffectType != 0) { ColorAffector aft; if (ColorAffectType == 2) { Color[] carr = new Color[4]; carr[0] = Color1; carr[1] = Color2; carr[2] = Color3; carr[3] = Color4; aft = new ColorAffector(carr, ColorGradualTimeLength, ColorGradualType, node); } else { Color[] carr = new Color[2]; carr[0] = Color1; carr[1] = Color2; aft = new ColorAffector(carr, ColorGradualTimeLength, ColorGradualType, node); } AffectorList.Add(aft); } if (LinearForceAffectorEnable) { Affector aft = new LinearForceAffector(LinearForce.normalized * LinearMagnitude, node); AffectorList.Add(aft); } if (JetAffectorEnable) { Affector aft = new JetAffector(JetMin, JetMax, node); AffectorList.Add(aft); } if (VortexAffectorEnable) { Affector aft; if (UseVortexCurve) { aft = new VortexAffector(VortexCurve, VortexDirection, node); } else { aft = new VortexAffector(VortexMag, VortexDirection, node); } AffectorList.Add(aft); } if (AttractionAffectorEnable) { Affector aft; if (UseVortexCurve) { aft = new AttractionForceAffector(AttractionCurve, AttractionPosition, node); } else { aft = new AttractionForceAffector(AttractMag, AttractionPosition, node); } AffectorList.Add(aft); } return(AffectorList); }
protected ArrayList InitAffectors(EffectNode node) { ArrayList arrayList = new ArrayList(); if (UVAffectorEnable) { UVAnimation uVAnimation = new UVAnimation(); Texture texture = Vertexpool.GetMaterial().GetTexture("_MainTex"); if (UVType == 2) { uVAnimation.BuildFromFile(EanPath, EanIndex, UVTime, texture); OriLowerLeftUV = uVAnimation.frames[0]; OriUVDimensions = uVAnimation.UVDimensions[0]; } else if (UVType == 1) { float num = texture.width / Cols; float num2 = texture.height / Rows; Vector2 vector = new Vector2(num / (float)texture.width, num2 / (float)texture.height); Vector2 vector2 = new Vector2(0f, 1f); uVAnimation.BuildUVAnim(vector2, vector, Cols, Rows, Cols * Rows); OriLowerLeftUV = vector2; OriUVDimensions = vector; OriUVDimensions.y = 0f - OriUVDimensions.y; } if (uVAnimation.frames.Length == 1) { OriLowerLeftUV = uVAnimation.frames[0]; OriUVDimensions = uVAnimation.UVDimensions[0]; } else { uVAnimation.loopCycles = LoopCircles; Affector value = new UVAffector(uVAnimation, UVTime, node); arrayList.Add(value); } } if (RotAffectorEnable && RotateType != 0) { Affector value2 = (RotateType != RSTYPE.CURVE) ? new RotateAffector(DeltaRot, node) : new RotateAffector(RotateCurve, node); arrayList.Add(value2); } if (ScaleAffectorEnable && ScaleType != 0) { Affector value3 = (ScaleType != RSTYPE.CURVE) ? new ScaleAffector(DeltaScaleX, DeltaScaleY, node) : new ScaleAffector(ScaleXCurve, ScaleYCurve, node); arrayList.Add(value3); } if (ColorAffectorEnable && ColorAffectType != 0) { ColorAffector value4 = (ColorAffectType != 2) ? new ColorAffector(new Color[2] { Color1, Color2 }, ColorGradualTimeLength, ColorGradualType, node) : new ColorAffector(new Color[4] { Color1, Color2, Color3, Color4 }, ColorGradualTimeLength, ColorGradualType, node); arrayList.Add(value4); } if (LinearForceAffectorEnable) { Affector value5 = new LinearForceAffector(LinearForce.normalized * LinearMagnitude, node); arrayList.Add(value5); } if (JetAffectorEnable) { Affector value6 = new JetAffector(JetMin, JetMax, node); arrayList.Add(value6); } if (VortexAffectorEnable) { Affector value7 = (!UseVortexCurve) ? new VortexAffector(VortexMag, VortexDirection, node) : new VortexAffector(VortexCurve, VortexDirection, node); arrayList.Add(value7); } if (AttractionAffectorEnable) { Affector value8 = (!UseVortexCurve) ? new AttractionForceAffector(AttractMag, AttractionPosition, node) : new AttractionForceAffector(AttractionCurve, AttractionPosition, node); arrayList.Add(value8); } return(arrayList); }
protected ArrayList InitAffectors(EffectNode node) { var list = new ArrayList(); if (UVAffectorEnable) { var frame = new UVAnimation(); var mainTex = Vertexpool.GetMaterial().GetTexture("_MainTex"); if (UVType == 2) { frame.BuildFromFile(EanPath, EanIndex, UVTime, mainTex); OriLowerLeftUV = frame.frames[0]; OriUVDimensions = frame.UVDimensions[0]; } else if (UVType == 1) { float num = mainTex.width / Cols; float num2 = mainTex.height / Rows; var cellSize = new Vector2(num / mainTex.width, num2 / mainTex.height); var start = new Vector2(0f, 1f); frame.BuildUVAnim(start, cellSize, Cols, Rows, Cols * Rows); OriLowerLeftUV = start; OriUVDimensions = cellSize; OriUVDimensions.y = -OriUVDimensions.y; } if (frame.frames.Length == 1) { OriLowerLeftUV = frame.frames[0]; OriUVDimensions = frame.UVDimensions[0]; } else { frame.loopCycles = LoopCircles; Affector affector = new UVAffector(frame, UVTime, node); list.Add(affector); } } if (RotAffectorEnable && RotateType != RSTYPE.NONE) { Affector affector2; if (RotateType == RSTYPE.CURVE) { affector2 = new RotateAffector(RotateCurve, node); } else { affector2 = new RotateAffector(DeltaRot, node); } list.Add(affector2); } if (ScaleAffectorEnable && ScaleType != RSTYPE.NONE) { Affector affector3; if (ScaleType == RSTYPE.CURVE) { affector3 = new ScaleAffector(ScaleXCurve, ScaleYCurve, node); } else { affector3 = new ScaleAffector(DeltaScaleX, DeltaScaleY, node); } list.Add(affector3); } if (ColorAffectorEnable && ColorAffectType != 0) { ColorAffector affector4; if (ColorAffectType == 2) { Color[] colorArr = { Color1, Color2, Color3, Color4 }; affector4 = new ColorAffector(colorArr, ColorGradualTimeLength, ColorGradualType, node); } else { Color[] colorArray2 = { Color1, Color2 }; affector4 = new ColorAffector(colorArray2, ColorGradualTimeLength, ColorGradualType, node); } list.Add(affector4); } if (LinearForceAffectorEnable) { Affector affector5 = new LinearForceAffector(LinearForce.normalized * LinearMagnitude, node); list.Add(affector5); } if (JetAffectorEnable) { Affector affector6 = new JetAffector(JetMin, JetMax, node); list.Add(affector6); } if (VortexAffectorEnable) { Affector affector7; if (UseVortexCurve) { affector7 = new VortexAffector(VortexCurve, VortexDirection, node); } else { affector7 = new VortexAffector(VortexMag, VortexDirection, node); } list.Add(affector7); } if (AttractionAffectorEnable) { Affector affector8; if (UseVortexCurve) { affector8 = new AttractionForceAffector(AttractionCurve, AttractionPosition, node); } else { affector8 = new AttractionForceAffector(AttractMag, AttractionPosition, node); } list.Add(affector8); } return(list); }