示例#1
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);
    }
示例#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;
    }
    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);
    }
示例#4
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;
    }