Example #1
0
//$-----------------------------------------------------------------------------
//@ Animates Scale of Object using a shader that has the _echoScale property
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# iscalestart     - Scaling Start value
//# iscaleend       - Scaling End value
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Animate_echoScale(EchoGameObject iego, Vector3 iscalestart, Vector3 iscaleend, float ifxduration = 0.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter = EchoFilter.LINEAR;
            efx.eventType  = EchoET.ECHOSCALE;
            efx.ego        = iego;

            efx.fxScale1.x = iscalestart.x;
            efx.fxScale1.y = iscalestart.y;
            efx.fxScale1.z = iscalestart.z;
            efx.fxScale1.w = 1.0f;

            efx.fxScale2.x = iscaleend.x;
            efx.fxScale2.y = iscaleend.y;
            efx.fxScale2.z = iscaleend.z;
            efx.fxScale2.w = 1.0f;

            efx.fxTime     = 0;
            efx.fxDuration = ifxduration;
        }

        return(efx);
    }
Example #2
0
//--------------------------------------------------------------------------
    public static void ProcessAllInUpdate()
    {
        EchoLinkedList epl;
        EchoLinkedList first;
        EchoLinkedList last;

        if (poolListID < 0)
        {
            return;
        }

        first = PoolGetFirstActive(poolListID);
        last  = PoolGetLastActive(poolListID);

        _ticks++;

        listFirst = null;

        // loop thru active events
        for (epl = first; epl != last; epl = epl.active_next)
        {
            epl.ProcessInUpdate();
        }

        // now process any gameobject submits
        while (listFirst != null)
        {
            listFirst.ShaderPropertiesSubmit();
            listFirst.echoFxFlag = false;
            listFirst            = listFirst.echoFxNext;
        }
    }
Example #3
0
//===========================================================================
    public EchoPoolList()
    {
        _go1 = new GameObject("Pool1");
        _go2 = new GameObject("Pool2");
        _go3 = new GameObject("Pool3");
        _go4 = new GameObject("Pool4");

        // setup active list
        active_first = _go1.AddComponent <EchoGameObject>();
        active_last  = _go2.AddComponent <EchoGameObject>();

        active_first.echoListNext = active_last;
        active_first.echoListPrev = null;

        active_last.echoListNext = null;
        active_last.echoListPrev = active_first;

        // setup inactive list
        inactive_first = _go3.AddComponent <EchoGameObject>();
        inactive_last  = _go4.AddComponent <EchoGameObject>();

        inactive_first.echoListNext = inactive_last;
        inactive_first.echoListPrev = null;

        inactive_last.echoListNext = null;
        inactive_last.echoListPrev = inactive_first;
    }
Example #4
0
//$-----------------------------------------------------------------------------
//@ Performs Cell Animation on an EchoGameObject
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# iuvcellwidth    - Width of the cell in UV space
//# iuvcellheight   - Height of the cell in UV space
//# icolumns        - Number of cells horizontally
//# icellcount      - Total number of cells in this animation
//# itimepercell    - The time to show each cell
//# ireps           - How many times to repeat this animation. 0 = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent CellAnimateBlend_echoUV(EchoGameObject iego, float iuvcellwidth, float iuvcellheight, int icolumns, int istartcell, int icellcount, float itimepercell, int ireps = 1)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter       = EchoFilter.LINEAR;
            efx.eventType        = EchoET.CELLANIM_BLEND;
            efx.ego              = iego;
            efx.fxUse_MainTex_ST = 0;
            efx.fxArg1           = iuvcellwidth;
            efx.fxArg2           = iuvcellheight;
            efx.fxIArg1          = icolumns;
            //		efx.fxIArg2					= irows;
            efx.fxAnimReps       = ireps;
            efx.fxAnimCellCount  = icellcount;
            efx.fxTime           = itimepercell + 1.0f;
            efx.fxDuration       = itimepercell;
            efx.fxAnimCurCell    = istartcell;
            efx.fxAnimCurCellDir = 1;
            efx.fxAnimCellStart  = istartcell;
        }

        return(efx);
    }
Example #5
0
//$-----------------------------------------------------------------------------
//@ Performs Cell Animation on an EchoGameObject using pre-allocated UV sets
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# istartcell      - uvset index to start animation on
//# icellcount      - Total number of cells\uvsets in this animation
//# itimepercell    - The time to show each cell
//# ireps           - How many times to repeat this animation. 0 = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent CellAnimate_UVSet(EchoGameObject iego, int istartcell, int icellcount, float ifpsspeed = 32.0f, int ireps = 0, float ifxduration = 0.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.fxSpeedCur = ifpsspeed;

            if (ifpsspeed < 0)
            {
                ifpsspeed = -ifpsspeed;
            }

            efx.echoFilter       = EchoFilter.LINEAR;
            efx.eventType        = EchoET.CELLANIM_UVSET;
            efx.ego              = iego;
            efx.fxUse_MainTex_ST = 0;
            efx.fxAnimReps       = ireps;
            efx.fxTime           = 0.0f;
            efx.fxDuration       = ifxduration;
            efx.fxFrameCur       = istartcell;
            efx.fxFrameFirst     = istartcell;
            efx.fxFrameLast      = istartcell + icellcount - 1;
            efx.fxSpeed          = ifpsspeed;
            efx.fxDamp           = 0;
        }

        return(efx);
    }
Example #6
0
//$-----------------------------------------------------------------------------
//@ Adds new object to pool
//@
//@ NOTE: This is normally handled by EchoGameObject. No user need to call this.
//@
//@ Parameters:
//@
//# iec         - EchoGameObject object to add
//&-----------------------------------------------------------------------------
    public void AddNewObject(EchoGameObject iec)
    {
        iec.echoListNext = inactive_last;
        iec.echoListPrev = inactive_last.echoListPrev;

        inactive_last.echoListPrev.echoListNext = iec;
        inactive_last.echoListPrev = iec;
    }
Example #7
0
//$-----------------------------------------------------------------------------
//@ Sets Random mix values for shaders that have the _echoMix property
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Random_echoMix(EchoGameObject iego, float ifxduration = 0.0f)
    {
        EchoFXEvent efx;

        efx           = PoolGetFreeInactive(poolListID) as EchoFXEvent;
        efx.eventType = EchoET.RANDOM_MIX;
        efx.ego       = iego;

        efx.fxTime     = 0;
        efx.fxDuration = ifxduration;
        efx.fxArg1     = 0.0f;
        efx.fxArg2     = 1.0f;

        return(efx);
    }
Example #8
0
//$-----------------------------------------------------------------------------
//@ Starts Dissolve effect for any echoLogin Dissolve Shaders
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# imix1           - Start of dissolve (-0.5 is all Off)
//# imix2           - Start of dissolve ( 1.5 is all On )
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Dissolve_echoShader(EchoGameObject iego, float imix1 = -0.5f, float imix2 = 1.5f, float ifxduration = 1.0f)
    {
        EchoFXEvent efx;

        efx           = PoolGetFreeInactive(poolListID) as EchoFXEvent;
        efx.eventType = EchoET.DISSOLVE;
        efx.ego       = iego;

        efx.fxTime     = 0;
        efx.fxDuration = ifxduration;
        efx.fxArg1     = imix1;
        efx.fxArg2     = imix2;

        return(efx);
    }
Example #9
0
//$-----------------------------------------------------------------------------
//@ Blinks Randomly between 2 UV sets
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# iuvoffset1      - UV offset from UV origin for first frame
//# iuvoffset2      - UV offset from UV origin for second frame
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Blink_echoUV(EchoGameObject iego, Vector4 iuvoffset1, Vector4 iuvoffset2, float ifxduration)
    {
        EchoFXEvent efx;

        efx           = PoolGetFreeInactive(poolListID) as EchoFXEvent;
        efx.eventType = EchoET.BLINK_ECHOUV;

        efx.ego = iego;
        efx.fxUse_MainTex_ST = 0;
        efx.fxTime           = 0;
        efx.fxDuration       = ifxduration;

        efx.fxUV1 = iuvoffset1;
        efx.fxUV2 = iuvoffset2;

        return(efx);
    }
Example #10
0
//$-----------------------------------------------------------------------------
//@ Blinks Randomly between 2 UV sets
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# iuvset1         - UV set for first frame
//# iuvset2         - UV set for second frame
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Blink_UVSet(EchoGameObject iego, int iuvset1, int iuvset2, float ifxduration)
    {
        EchoFXEvent efx;

        efx           = PoolGetFreeInactive(poolListID) as EchoFXEvent;
        efx.eventType = EchoET.BLINK_UVSET;

        efx.ego = iego;
        efx.fxUse_MainTex_ST = 0;
        efx.fxTime           = 0;
        efx.fxDuration       = ifxduration;

        efx.fxIArg1 = iuvset1;
        efx.fxIArg2 = iuvset2;

        return(efx);
    }
Example #11
0
//$-----------------------------------------------------------------------------
//@ Generates Random UV coordinates
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Random_echoUV(EchoGameObject iego, float ifxduration = 0.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter       = EchoFilter.LINEAR;
            efx.eventType        = EchoET.RANDOM_ECHOUV;
            efx.ego              = iego;
            efx.fxUse_MainTex_ST = 0;
            efx.fxUVAdd          = new Vector4(0, 0, 0, 0);
            efx.fxTime           = 0;
            efx.fxDuration       = ifxduration;
        }

        return(efx);
    }
Example #12
0
//$-----------------------------------------------------------------------------
//@ Animates Shader Tiling values from itilestart to itileend
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# itilestart      - Tiling Start value
//# itileend        - Tiling End value
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Animate_ShaderTiling(EchoGameObject iego, Vector2 itilestart, Vector2 itileend, float ifxduration = 0.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter = EchoFilter.LINEAR;
            efx.eventType  = EchoET.ANIMATE_TILING;
            efx.ego        = iego;
            efx.fxTile1    = itilestart;
            efx.fxTile2    = itileend;
            efx.fxTime     = 0;
            efx.fxDuration = ifxduration;
        }

        return(efx);
    }
Example #13
0
//$-----------------------------------------------------------------------------
//@ Animates Alpha of Object using a shader that has the _echoAlpha property
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# ialphastart     - Alpha Start value
//# ialphaend       - Alpha End value
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Animate_echoAlpha(EchoGameObject iego, float ialphastart, float ialphaend, float ifxduration = 0.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter = EchoFilter.LINEAR;
            efx.eventType  = EchoET.ECHOALPHA;
            efx.ego        = iego;
            efx.fxArg1     = ialphastart;
            efx.fxArg2     = ialphaend;
            efx.fxTime     = 0;
            efx.fxDuration = ifxduration;
        }

        return(efx);
    }
Example #14
0
//$-----------------------------------------------------------------------------
//@ Starts a Fusion effect for the EchoLogin Fusion Shader
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# istart          - Start size of effect
//# iend            - End size of effect
//# ijitter         - Amount of random jitters while effect is active
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Fusion_echoShader(EchoGameObject iego, float istart, float iend, float ijitter, float ifxduration = 1.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.eventType  = EchoET.FUSION;
            efx.ego        = iego;
            efx.fxArg1     = istart;
            efx.fxArg2     = iend;
            efx.fxArg3     = ijitter;
            efx.fxTime     = 0;
            efx.fxDuration = ifxduration;
        }

        return(efx);
    }
Example #15
0
//$-----------------------------------------------------------------------------
//@ Animates RGBA of Object using a shader that has the _echoRGBA property
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# ialphastart     - Alpha Start value
//# ialphaend       - Alpha End value
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Animate_echoRGBA(EchoGameObject iego, Vector4 irgba1, Vector4 irgba2, float ifxduration = 1.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter = EchoFilter.LINEAR;
            efx.eventType  = EchoET.ECHORGBA;
            efx.ego        = iego;
            efx.fxTime     = 0;
            efx.fxDuration = ifxduration;
            efx.fxRGBA1    = irgba1;
            efx.fxRGBA2    = irgba2;
        }

        return(efx);
    }
Example #16
0
//$-----------------------------------------------------------------------------
//@ Starts a Shield Down/Destroyed type effect on the EchoLogin Shield Shader
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# imaxalpha       - Maximum alpha of the hit effect
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent ShieldDown_echoShader(EchoGameObject iego, float imaxalpha, float ifxduration = 2.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter = EchoFilter.LINEAR;
            efx.eventType  = EchoET.SHIELD_DOWN;
            efx.ego        = iego;

            efx.fxStage    = 0;
            efx.fxTime     = 0;
            efx.fxDuration = ifxduration;
            efx.fxArg1     = imaxalpha;
        }

        return(efx);
    }
Example #17
0
//$-----------------------------------------------------------------------------
//@ Moves object from active to inactive list
//@
//@ NOTE: This is normally handled by EchoGameObject. No user need to call this.
//@
//@ Parameters:
//@
//# iec         - EchoGameObject object to move
//&-----------------------------------------------------------------------------
    public void ReturnPool(EchoGameObject iec)
    {
        if (iec.echo_PoolActiveList == false)
        {
            return;
        }

        iec.echo_PoolActiveList = true;

        // remove from active list
        iec.echoListPrev.echoListNext = iec.echoListNext;
        iec.echoListNext.echoListPrev = iec.echoListPrev;

        // add to inactive
        iec.echoListNext = inactive_last;
        iec.echoListPrev = inactive_last.echoListPrev;

        inactive_last.echoListPrev.echoListNext = iec;
        inactive_last.echoListPrev = iec;
    }
Example #18
0
//==========================================================================
    private void AddToEgoList()
    {
        if (ego.echoFxFlag == false)
        {
            ego.echoFxFlag = true;

            if (listFirst == null)
            {
                listFirst            = ego;
                listFirst.echoFxNext = null;
                listLast             = ego;
            }
            else
            {
                listLast.echoFxNext = ego;
                listLast            = ego;
                listLast.echoFxNext = null;
            }
        }
    }
Example #19
0
//$-----------------------------------------------------------------------------
//@ Animates the UV coordinates of an echoLogin Shader
//@
//@ Parameters:
//@
//# iego        - EchoGameObject that will have this EchoFXEvent
//# iuvAdd      - Value added to the UV coordinates of each frame
//# ifxduration - Duration of this effect. 0.0f means forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent Scroll_echoUV(EchoGameObject iego, Vector4 iuvAdd, float ifxduration = 0.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter       = EchoFilter.LINEAR;
            efx.eventType        = EchoET.SCROLL_ECHOUV;
            efx.ego              = iego;
            efx.fxUse_MainTex_ST = 0;
            efx.fxUVAdd          = iuvAdd;
            efx.fxTime           = 0;
            efx.fxDuration       = ifxduration;
            efx.fxAnimCurCellDir = 1.0f;
        }


        return(efx);
    }
Example #20
0
//$-----------------------------------------------------------------------------
//@ Scrolls an object's UV from iuvstart to iuvend
//@
//@ Parameters:
//@
//# iego        - EchoGameObject that will have this EchoFXEvent
//# iuvstart    - UV position on texture to start
//# iuvend      - UV position to end scroll
//# ireps       - Number of repetitions to scroll. 0 = forever
//# ifxduration - Duration of one repetition of a scroll
//&-----------------------------------------------------------------------------
    public static EchoFXEvent ScrollSection_echoUV(EchoGameObject iego, Vector4 iuvstart, Vector4 iuvend, int ireps, float ifxduration = 1.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter       = EchoFilter.LINEAR;
            efx.eventType        = EchoET.SCROLL_SECTION_ECHOUV;
            efx.ego              = iego;
            efx.fxUse_MainTex_ST = 0;
            efx.fxUV1            = iuvstart;
            efx.fxUV2            = iuvend;
            efx.fxTime           = 0;
            efx.fxAnimReps       = ireps;
            efx.fxDuration       = ifxduration;
        }

        return(efx);
    }
Example #21
0
//$=============================================================================
//@ Sets up a custom user event
//@
//@ Parameters:
//@
//# iego		- EchoGameObject that will have this EchoFXEvent
//# itime       - Start time
//# iduration   - Duration of the effect
//# icallback   - Callback that processes this effect
//&=============================================================================
    public static EchoFXEvent StartEventCustom(EchoGameObject iego, float itime, float iduration, EventCustom icallback)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter    = EchoFilter.LINEAR;
            efx.fxAmplitude   = 1.0f;
            efx.fxPeriod      = 1.0f;
            efx.fxOffset      = 0.0f;
            efx.eventType     = EchoET.CUSTOM;
            efx.ego           = iego;
            efx.fxDuration    = iduration;
            efx.fxTime        = itime;
            efx.fxEventCustom = icallback;
        }

        return(efx);
    }
Example #22
0
//$-----------------------------------------------------------------------------
//@ Starts a Shield Hit effect on the EchoLogin Shield Shader
//@
//@ Parameters:
//@
//# iego            - EchoGameObject that will have this EchoFXEvent
//# ihitid          - 0-3 id of the hit of which there can be up to 4 at one time
//# idirection      - Direction vector of the hit
//# iminalpha       - Minimum alpha of the hit effect
//# imaxalpha       - Maximum alpha of the hit effect
//# ifxduration     - Duration of this effect. 0.0f = forever
//&-----------------------------------------------------------------------------
    public static EchoFXEvent ShieldHit_echoShader(EchoGameObject iego, int ihitid, Vector3 idirection, float iminalpha, float imaxalpha, float ifxduration = 0.0f)
    {
        EchoFXEvent efx;

        efx = PoolGetFreeInactive(poolListID) as EchoFXEvent;

        if (efx != null)
        {
            efx.echoFilter    = EchoFilter.LINEAR;
            efx.eventType     = EchoET.SHIELD_HIT;
            efx.ego           = iego;
            efx.fxArg1        = iminalpha;
            efx.fxArg2        = imaxalpha;
            efx.fxTime        = 0;
            efx.fxDuration    = ifxduration;
            efx.fxShieldHitID = ihitid;

            efx.ego.ShaderSet_echoHitVectorOn(idirection, efx.fxShieldHitID);
        }


        return(efx);
    }
Example #23
0
//$-----------------------------------------------------------------------------
//@ Gets an inactive object for use from the object pool
//@
//@ NOTE: This should be called from your class derived from EchoPoolManager.
//@
//&-----------------------------------------------------------------------------
    public EchoGameObject GetFree()
    {
        EchoGameObject ec = inactive_first.echoListNext;

        if (ec == inactive_last)
        {
            return(null);
        }

        ec.echo_PoolActiveList = true;

        // remove from inactive list
        ec.echoListPrev.echoListNext = ec.echoListNext;
        ec.echoListNext.echoListPrev = ec.echoListPrev;

        // add to active
        ec.echoListNext = active_last;
        ec.echoListPrev = active_last.echoListPrev;

        active_last.echoListPrev.echoListNext = ec;
        active_last.echoListPrev = ec;

        return(ec);
    }
Example #24
0
//===========================================================================
    private bool EventCustomNull(EchoGameObject iego, float ipercentdone, float iratio, float itime)
    {
        return(true);
    }
Example #25
0
 public void Active2Inactive(EchoGameObject iec)
 {
     ReturnPool(iec);
 }