protected ArrayList InitAffectors(EffectNode node)
    {
        ArrayList AffectorList = new ArrayList();

        if (UVAffectorEnable)
        {
            UVAnimation uvAnim = new UVAnimation();
            if (UVType == 1)
            {
                float   perWidth  = OriUVDimensions.x / Cols;
                float   perHeight = Mathf.Abs(OriUVDimensions.y / Rows);
                Vector2 cellSize  = new Vector2(perWidth, perHeight);
                uvAnim.BuildUVAnim(OriTopLeftUV, cellSize, Cols, Rows, Cols * Rows);
            }
            UVDimension = uvAnim.UVDimensions[0];
            UVTopLeft   = uvAnim.frames[0];

            if (uvAnim.frames.Length != 1)
            {
                uvAnim.loopCycles = LoopCircles;
                Affector aft = new UVAffector(uvAnim, UVTime, node, RandomStartFrame);
                AffectorList.Add(aft);
            }
        }
        else
        {
            UVDimension = OriUVDimensions;
            UVTopLeft   = OriTopLeftUV;
        }


        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[5];
                carr[0] = Color1; carr[1] = Color2; carr[2] = Color3; carr[3] = Color4; carr[4] = Color5;
                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 (JetAffectorEnable)
        {
            Affector aft = new JetAffector(JetMin, JetMax, node);
            AffectorList.Add(aft);
        }
        if (VortexAffectorEnable)
        {
            Affector aft;
            aft = new VortexAffector(VortexObj, VortexMagType, VortexMag, VortexCurve, VortexDirection, VortexInheritRotation, node);

            AffectorList.Add(aft);
        }
        if (UVRotAffectorEnable)
        {
            Affector aft;
            aft = new UVRotAffector(UVRotXSpeed, UVRotYSpeed, node);
            AffectorList.Add(aft);
        }


        if (GravityAffectorEnable)
        {
            Affector aft;
            aft = new GravityAffector(GravityObject, GravityAftType, GravityMagType, IsGravityAccelerate, GravityDirection, GravityMag, GravityCurve, node);
            AffectorList.Add(aft);

            if (GravityAftType == GAFTTYPE.Spherical && GravityObject == null)
            {
                Debug.LogWarning("Gravity Object is missing, automatically set to effect layer self.");
                GravityObject = transform;
            }
        }
        if (AirAffectorEnable)
        {
            Affector aft = new AirFieldAffector(AirObject, AirDirection, AirMagType, AirMagnitude, AirMagCurve, AirAttenuation, AirUseMaxDistance,
                                                AirMaxDistance, AirEnableSpread, AirSpread, AirInheritVelocity, AirInheritRotation, node);
            AffectorList.Add(aft);
        }
        if (BombAffectorEnable)
        {
            Affector aft = new BombAffector(BombObject, BombType, BombMagType, BombDecayType, BombMagnitude, BombMagCurve, BombDecay, BombAxis, node);
            AffectorList.Add(aft);
        }
        if (TurbulenceAffectorEnable)
        {
            Affector aft = new TurbulenceFieldAffector(TurbulenceObject, TurbulenceMagType, TurbulenceMagnitude, TurbulenceMagCurve, TurbulenceAttenuation, TurbulenceUseMaxDistance, TurbulenceMaxDistance, node);
            AffectorList.Add(aft);
        }
        return(AffectorList);
    }
Example #2
0
    protected List <Affector> InitAffectors(EffectNode node)
    {
        List <Affector> AffectorList = new List <Affector>();

        if (UVAffectorEnable)
        {
            UVAnimation uvAnim = new UVAnimation();
            if (UVType == 1)
            {
                float   perWidth  = OriUVDimensions.x / Cols;
                float   perHeight = Mathf.Abs(OriUVDimensions.y / Rows);
                Vector2 cellSize  = new Vector2(perWidth, perHeight);
                uvAnim.BuildUVAnim(OriTopLeftUV, cellSize, Cols, Rows, Cols * Rows);
            }
            UVDimension = uvAnim.UVDimensions[0];
            UVTopLeft   = uvAnim.frames[0];

            if (uvAnim.frames.Length != 1)
            {
                uvAnim.loopCycles = LoopCircles;
                Affector aft = new UVAffector(uvAnim, UVTime, node, RandomStartFrame);
                AffectorList.Add(aft);
            }
        }
        else
        {
            UVDimension = OriUVDimensions;
            UVTopLeft   = OriTopLeftUV;
        }


        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 (UseSameScaleCurve)
            {
                ScaleYCurve = ScaleXCurve;
            }

            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 = new ColorAffector(this, node);
            AffectorList.Add(aft);
        }
        if (JetAffectorEnable)
        {
            Affector aft = new JetAffector(JetMag, JetMagType, JetCurve, node);
            AffectorList.Add(aft);
        }
        if (VortexAffectorEnable)
        {
            Affector aft;
            aft = new VortexAffector(VortexObj, VortexMagType, VortexMag, VortexCurve, VortexDirection, VortexInheritRotation, node);

            AffectorList.Add(aft);
        }
        if (UVRotAffectorEnable)
        {
            Affector aft;

            float xscroll = UVRotXSpeed;
            float yscroll = UVRotYSpeed;
            if (RandomUVRotateSpeed)
            {
                xscroll = Random.Range(UVRotXSpeed, UVRotXSpeedMax);
                yscroll = Random.Range(UVRotYSpeed, UVRotYSpeedMax);
            }

            aft = new UVRotAffector(xscroll, yscroll, node);
            AffectorList.Add(aft);
        }


        if (GravityAffectorEnable)
        {
            Affector aft;
            aft = new GravityAffector(GravityObject, GravityAftType, GravityMagType, IsGravityAccelerate, GravityDirection, GravityMag, GravityCurve, node);
            AffectorList.Add(aft);

            if (GravityAftType == GAFTTYPE.Spherical && GravityObject == null)
            {
                Debug.LogWarning("Gravity Object is missing, automatically set to effect layer self:" + gameObject.name);
                GravityObject = transform;
            }
        }
        if (AirAffectorEnable)
        {
            Affector aft = new AirFieldAffector(AirObject, AirDirection, AirMagType, AirMagnitude, AirMagCurve, AirAttenuation, AirUseMaxDistance,
                                                AirMaxDistance, AirEnableSpread, AirSpread, AirInheritVelocity, AirInheritRotation, node);
            AffectorList.Add(aft);
        }
        if (BombAffectorEnable)
        {
            Affector aft = new BombAffector(BombObject, BombType, BombMagType, BombDecayType, BombMagnitude, BombMagCurve, BombDecay, BombAxis, node);
            AffectorList.Add(aft);
        }
        if (TurbulenceAffectorEnable)
        {
            Affector aft = new TurbulenceFieldAffector(TurbulenceObject, TurbulenceMagType, TurbulenceMagnitude, TurbulenceMagCurve, TurbulenceAttenuation, TurbulenceUseMaxDistance, TurbulenceMaxDistance, node);
            AffectorList.Add(aft);
        }
        if (DragAffectorEnable)
        {
            Affector aft = new DragAffector(DragObj, DragUseDir, DragDir, DragMag, DragUseMaxDist, DragMaxDist, DragAtten, node);
            AffectorList.Add(aft);
        }
        return(AffectorList);
    }
Example #3
0
    protected ArrayList InitAffectors(EffectNode node)
    {
        ArrayList list = new ArrayList();

        if (this.UVAffectorEnable)
        {
            UVAnimation frame   = new UVAnimation();
            Texture     mainTex = this.Vertexpool.GetMaterial().GetTexture("_MainTex");
            if (this.UVType == 2)
            {
                frame.BuildFromFile(this.EanPath, this.EanIndex, this.UVTime, mainTex);
                this.OriLowerLeftUV  = frame.frames[0];
                this.OriUVDimensions = frame.UVDimensions[0];
            }
            else if (this.UVType == 1)
            {
                float   num      = mainTex.width / this.Cols;
                float   num2     = mainTex.height / this.Rows;
                Vector2 cellSize = new Vector2(num / ((float)mainTex.width), num2 / ((float)mainTex.height));
                Vector2 start    = new Vector2(0f, 1f);
                frame.BuildUVAnim(start, cellSize, this.Cols, this.Rows, this.Cols * this.Rows);
                this.OriLowerLeftUV    = start;
                this.OriUVDimensions   = cellSize;
                this.OriUVDimensions.y = -this.OriUVDimensions.y;
            }
            if (frame.frames.Length == 1)
            {
                this.OriLowerLeftUV  = frame.frames[0];
                this.OriUVDimensions = frame.UVDimensions[0];
            }
            else
            {
                frame.loopCycles = this.LoopCircles;
                Affector affector = new UVAffector(frame, this.UVTime, node);
                list.Add(affector);
            }
        }
        if (this.RotAffectorEnable && (this.RotateType != RSTYPE.NONE))
        {
            Affector affector2;
            if (this.RotateType == RSTYPE.CURVE)
            {
                affector2 = new RotateAffector(this.RotateCurve, node);
            }
            else
            {
                affector2 = new RotateAffector(this.DeltaRot, node);
            }
            list.Add(affector2);
        }
        if (this.ScaleAffectorEnable && (this.ScaleType != RSTYPE.NONE))
        {
            Affector affector3;
            if (this.ScaleType == RSTYPE.CURVE)
            {
                affector3 = new ScaleAffector(this.ScaleXCurve, this.ScaleYCurve, node);
            }
            else
            {
                affector3 = new ScaleAffector(this.DeltaScaleX, this.DeltaScaleY, node);
            }
            list.Add(affector3);
        }
        if (this.ColorAffectorEnable && (this.ColorAffectType != 0))
        {
            ColorAffector affector4;
            if (this.ColorAffectType == 2)
            {
                Color[] colorArr = new Color[] { this.Color1, this.Color2, this.Color3, this.Color4 };
                affector4 = new ColorAffector(colorArr, this.ColorGradualTimeLength, this.ColorGradualType, node);
            }
            else
            {
                Color[] colorArray2 = new Color[] { this.Color1, this.Color2 };
                affector4 = new ColorAffector(colorArray2, this.ColorGradualTimeLength, this.ColorGradualType, node);
            }
            list.Add(affector4);
        }
        if (this.LinearForceAffectorEnable)
        {
            Affector affector5 = new LinearForceAffector((Vector3)(this.LinearForce.normalized * this.LinearMagnitude), node);
            list.Add(affector5);
        }
        if (this.JetAffectorEnable)
        {
            Affector affector6 = new JetAffector(this.JetMin, this.JetMax, node);
            list.Add(affector6);
        }
        if (this.VortexAffectorEnable)
        {
            Affector affector7;
            if (this.UseVortexCurve)
            {
                affector7 = new VortexAffector(this.VortexCurve, this.VortexDirection, node);
            }
            else
            {
                affector7 = new VortexAffector(this.VortexMag, this.VortexDirection, node);
            }
            list.Add(affector7);
        }
        if (this.AttractionAffectorEnable)
        {
            Affector affector8;
            if (this.UseVortexCurve)
            {
                affector8 = new AttractionForceAffector(this.AttractionCurve, this.AttractionPosition, node);
            }
            else
            {
                affector8 = new AttractionForceAffector(this.AttractMag, this.AttractionPosition, node);
            }
            list.Add(affector8);
        }
        return(list);
    }
Example #4
0
    protected List<Affector> InitAffectors(EffectNode node)
    {
        List<Affector> AffectorList = new List<Affector>();

        if (UVAffectorEnable)
        {
            UVAnimation uvAnim = new UVAnimation();
            if (UVType == 1)
            {
                float perWidth = OriUVDimensions.x / Cols;
                float perHeight = Mathf.Abs(OriUVDimensions.y / Rows);
                Vector2 cellSize = new Vector2(perWidth, perHeight);
                uvAnim.BuildUVAnim(OriTopLeftUV, cellSize, Cols, Rows, Cols * Rows);
            }
            UVDimension = uvAnim.UVDimensions[0];
            UVTopLeft = uvAnim.frames[0];

            if (uvAnim.frames.Length != 1)
            {
                uvAnim.loopCycles = LoopCircles;
                Affector aft = new UVAffector(uvAnim, UVTime, node, RandomStartFrame);
                AffectorList.Add(aft);
            }
        }
        else
        {
            UVDimension = OriUVDimensions;
            UVTopLeft = OriTopLeftUV;
        }

        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 (UseSameScaleCurve)
                ScaleYCurve = ScaleXCurve;

            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 = new ColorAffector(this, node);
            AffectorList.Add(aft);
        }
        if (JetAffectorEnable)
        {
            Affector aft = new JetAffector(JetMag,JetMagType,JetCurve,node);
            AffectorList.Add(aft);
        }
        if (VortexAffectorEnable)
        {
            Affector aft;
            aft = new VortexAffector(VortexObj, VortexMagType, VortexMag, VortexCurve, VortexDirection, VortexInheritRotation, node);

            AffectorList.Add(aft);
        }
        if (UVRotAffectorEnable)
        {
            Affector aft;

            float xscroll = UVRotXSpeed;
            float yscroll = UVRotYSpeed;
            if (RandomUVRotateSpeed)
            {
                xscroll = Random.Range(UVRotXSpeed,UVRotXSpeedMax);
                yscroll = Random.Range(UVRotYSpeed,UVRotYSpeedMax);
            }

            aft = new UVRotAffector(xscroll, yscroll, node);
            AffectorList.Add(aft);
        }

        if (GravityAffectorEnable)
        {
            Affector aft;
            aft = new GravityAffector(GravityObject, GravityAftType, GravityMagType, IsGravityAccelerate,GravityDirection, GravityMag, GravityCurve, node);
            AffectorList.Add(aft);

            if (GravityAftType == GAFTTYPE.Spherical && GravityObject == null)
            {
                Debug.LogWarning("Gravity Object is missing, automatically set to effect layer self:" + gameObject.name);
                GravityObject = transform;
            }

        }
        if (AirAffectorEnable)
        {
            Affector aft = new AirFieldAffector(AirObject, AirDirection, AirMagType, AirMagnitude, AirMagCurve, AirAttenuation, AirUseMaxDistance,
                AirMaxDistance, AirEnableSpread, AirSpread, AirInheritVelocity, AirInheritRotation, node);
            AffectorList.Add(aft);
        }
        if (BombAffectorEnable)
        {
            Affector aft = new BombAffector(BombObject, BombType, BombMagType, BombDecayType, BombMagnitude, BombMagCurve, BombDecay, BombAxis, node);
            AffectorList.Add(aft);
        }
        if (TurbulenceAffectorEnable)
        {
            Affector aft = new TurbulenceFieldAffector(TurbulenceObject, TurbulenceMagType, TurbulenceMagnitude, TurbulenceMagCurve, TurbulenceAttenuation, TurbulenceUseMaxDistance, TurbulenceMaxDistance, node);
            AffectorList.Add(aft);
        }
        if (DragAffectorEnable)
        {
            Affector aft = new DragAffector(DragObj,DragUseDir,DragDir,DragMag,DragUseMaxDist,DragMaxDist,DragAtten,node);
            AffectorList.Add(aft);
        }
        return AffectorList;
    }
Example #5
0
    protected ArrayList InitAffectors(EffectNode node)
    {
        ArrayList AffectorList = new ArrayList();

        if (UVAffectorEnable)
        {
            UVAnimation uvAnim = new UVAnimation();
            if (UVType == 1)
            {
                float perWidth = OriUVDimensions.x / Cols;
                float perHeight = Mathf.Abs(OriUVDimensions.y / Rows);
                Vector2 cellSize = new Vector2(perWidth, perHeight);
                uvAnim.BuildUVAnim(OriTopLeftUV, cellSize, Cols, Rows, Cols * Rows);
            }
            UVDimension = uvAnim.UVDimensions[0];
            UVTopLeft = uvAnim.frames[0];

            if (uvAnim.frames.Length != 1)
            {
                uvAnim.loopCycles = LoopCircles;
                Affector aft = new UVAffector(uvAnim, UVTime, node, RandomStartFrame);
                AffectorList.Add(aft);
            }
        }
        else
        {
            UVDimension = OriUVDimensions;
            UVTopLeft = OriTopLeftUV;
        }

        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[5];
                carr[0] = Color1; carr[1] = Color2; carr[2] = Color3; carr[3] = Color4; carr[4] = Color5;
                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 (JetAffectorEnable)
        {
            Affector aft = new JetAffector(JetMin, JetMax, node);
            AffectorList.Add(aft);
        }
        if (VortexAffectorEnable)
        {
            Affector aft;
            aft = new VortexAffector(VortexObj, VortexMagType, VortexMag, VortexCurve, VortexDirection, VortexInheritRotation, node);

            AffectorList.Add(aft);
        }
        if (UVRotAffectorEnable)
        {
            Affector aft;
            aft = new UVRotAffector(UVRotXSpeed, UVRotYSpeed, node);
            AffectorList.Add(aft);
        }

        if (GravityAffectorEnable)
        {
            Affector aft;
            aft = new GravityAffector(GravityObject, GravityAftType, GravityMagType, IsGravityAccelerate,GravityDirection, GravityMag, GravityCurve, node);
            AffectorList.Add(aft);

            if (GravityAftType == GAFTTYPE.Spherical && GravityObject == null)
            {
                Debug.LogWarning("Gravity Object is missing, automatically set to effect layer self.");
                GravityObject = transform;
            }

        }
        if (AirAffectorEnable)
        {
            Affector aft = new AirFieldAffector(AirObject, AirDirection, AirMagType, AirMagnitude, AirMagCurve, AirAttenuation, AirUseMaxDistance,
                AirMaxDistance, AirEnableSpread, AirSpread, AirInheritVelocity, AirInheritRotation, node);
            AffectorList.Add(aft);
        }
        if (BombAffectorEnable)
        {
            Affector aft = new BombAffector(BombObject, BombType, BombMagType, BombDecayType, BombMagnitude, BombMagCurve, BombDecay, BombAxis, node);
            AffectorList.Add(aft);
        }
        if (TurbulenceAffectorEnable)
        {
            Affector aft = new TurbulenceFieldAffector(TurbulenceObject, TurbulenceMagType, TurbulenceMagnitude, TurbulenceMagCurve, TurbulenceAttenuation, TurbulenceUseMaxDistance, TurbulenceMaxDistance, node);
            AffectorList.Add(aft);
        }
        return AffectorList;
    }
Example #6
0
    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);
    }
Example #7
0
    protected ArrayList InitAffectors(EffectNode node)
    {
        ArrayList arrayList = new ArrayList();

        if (this.UVAffectorEnable)
        {
            UVAnimation uvanimation = new UVAnimation();
            Texture     texture     = this.Vertexpool.GetMaterial().GetTexture("_MainTex");
            if (this.UVType == 2)
            {
                uvanimation.BuildFromFile(this.EanPath, this.EanIndex, this.UVTime, texture);
                this.OriLowerLeftUV  = uvanimation.frames[0];
                this.OriUVDimensions = uvanimation.UVDimensions[0];
            }
            else if (this.UVType == 1)
            {
                float   num     = (float)(texture.width / this.Cols);
                float   num2    = (float)(texture.height / this.Rows);
                Vector2 vector  = new Vector2(num / (float)texture.width, num2 / (float)texture.height);
                Vector2 vector2 = new Vector2(0f, 1f);
                uvanimation.BuildUVAnim(vector2, vector, this.Cols, this.Rows, this.Cols * this.Rows);
                this.OriLowerLeftUV    = vector2;
                this.OriUVDimensions   = vector;
                this.OriUVDimensions.y = -this.OriUVDimensions.y;
            }
            if (uvanimation.frames.Length == 1)
            {
                this.OriLowerLeftUV  = uvanimation.frames[0];
                this.OriUVDimensions = uvanimation.UVDimensions[0];
            }
            else
            {
                uvanimation.loopCycles = this.LoopCircles;
                Affector value = new UVAffector(uvanimation, this.UVTime, node);
                arrayList.Add(value);
            }
        }
        if (this.RotAffectorEnable && this.RotateType != RSTYPE.NONE)
        {
            Affector value2;
            if (this.RotateType == RSTYPE.CURVE)
            {
                value2 = new RotateAffector(this.RotateCurve, node);
            }
            else
            {
                value2 = new RotateAffector(this.DeltaRot, node);
            }
            arrayList.Add(value2);
        }
        if (this.ScaleAffectorEnable && this.ScaleType != RSTYPE.NONE)
        {
            Affector value3;
            if (this.ScaleType == RSTYPE.CURVE)
            {
                value3 = new ScaleAffector(this.ScaleXCurve, this.ScaleYCurve, node);
            }
            else
            {
                value3 = new ScaleAffector(this.DeltaScaleX, this.DeltaScaleY, node);
            }
            arrayList.Add(value3);
        }
        if (this.ColorAffectorEnable && this.ColorAffectType != 0)
        {
            ColorAffector value4;
            if (this.ColorAffectType == 2)
            {
                value4 = new ColorAffector(new Color[]
                {
                    this.Color1,
                    this.Color2,
                    this.Color3,
                    this.Color4
                }, this.ColorGradualTimeLength, this.ColorGradualType, node);
            }
            else
            {
                value4 = new ColorAffector(new Color[]
                {
                    this.Color1,
                    this.Color2
                }, this.ColorGradualTimeLength, this.ColorGradualType, node);
            }
            arrayList.Add(value4);
        }
        if (this.LinearForceAffectorEnable)
        {
            Affector value5 = new LinearForceAffector(this.LinearForce.normalized * this.LinearMagnitude, node);
            arrayList.Add(value5);
        }
        if (this.JetAffectorEnable)
        {
            Affector value6 = new JetAffector(this.JetMin, this.JetMax, node);
            arrayList.Add(value6);
        }
        if (this.VortexAffectorEnable)
        {
            Affector value7;
            if (this.UseVortexCurve)
            {
                value7 = new VortexAffector(this.VortexCurve, this.VortexDirection, node);
            }
            else
            {
                value7 = new VortexAffector(this.VortexMag, this.VortexDirection, node);
            }
            arrayList.Add(value7);
        }
        if (this.AttractionAffectorEnable)
        {
            Affector value8;
            if (this.UseVortexCurve)
            {
                value8 = new AttractionForceAffector(this.AttractionCurve, this.AttractionPosition, node);
            }
            else
            {
                value8 = new AttractionForceAffector(this.AttractMag, this.AttractionPosition, node);
            }
            arrayList.Add(value8);
        }
        return(arrayList);
    }
Example #8
0
    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;
    }
Example #9
0
    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);
    }