示例#1
0
    // ------------------------------------------------------------------
    /// Stop the playing animation, take the action that setup in the
    /// exSpriteAnimState.stopAction
    // ------------------------------------------------------------------

    public void Stop()
    {
        if (curAnimation != null)
        {
            //
            exSpriteAnimClip.StopAction stopAction = curAnimation.stopAction;

            //
            curAnimation.time = 0.0f;
            curAnimation      = null;
            playing           = false;

            //
            switch (stopAction)
            {
            case exSpriteAnimClip.StopAction.DoNothing:
                // Nothing todo;
                break;

            case exSpriteAnimClip.StopAction.DefaultSprite:
                sprite.SetSprite(defaultAtlas, defaultIndex);
                break;

            case exSpriteAnimClip.StopAction.Hide:
                sprite.enabled = false;
                break;

            case exSpriteAnimClip.StopAction.Destroy:
                GameObject.Destroy(gameObject);
                break;
            }
        }
        enabled = false;
    }
示例#2
0
    [System.NonSerialized] public List<float> frameTimes; ///< the list of the start time in seconds of each frame in the exSpriteAnimClip

    // ------------------------------------------------------------------ 
    // Desc: 
    // ------------------------------------------------------------------ 

    void Init ( string _name, exSpriteAnimClip _animClip ) {
        clip = _animClip;
        name = _name;
        wrapMode = _animClip.wrapMode;
        stopAction = _animClip.stopAction;
        length = _animClip.length;
        speed = _animClip.speed;

        frameTimes = new List<float>(_animClip.frameInfos.Count);
        float tmp = 0.0f;
        foreach ( exSpriteAnimClip.FrameInfo fi in _animClip.frameInfos ) {
            tmp += fi.length;
            frameTimes.Add(tmp);
        }
    }
示例#3
0
    [System.NonSerialized] public List <float> frameTimes;                ///< the list of the start time in seconds of each frame in the exSpriteAnimClip

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    void Init(string _name, exSpriteAnimClip _animClip)
    {
        clip       = _animClip;
        name       = _name;
        wrapMode   = _animClip.wrapMode;
        stopAction = _animClip.stopAction;
        length     = _animClip.length;
        speed      = _animClip.speed;

        frameTimes = new List <float>(_animClip.frameInfos.Count);
        float tmp = 0.0f;

        for (int i = 0; i < _animClip.frameInfos.Count; ++i)
        {
            tmp += _animClip.frameInfos[i].length;
            frameTimes.Add(tmp);
        }
    }
示例#4
0
    [System.NonSerialized] public List <float> frameTimes;                ///< the list of the start time in seconds of each frame in the exSpriteAnimClip

    // ------------------------------------------------------------------
    /// \param _animClip the referenced animation clip
    /// Constructor of exSpriteAnimState, it will copy the settings from _animClip.
    // ------------------------------------------------------------------

    public exSpriteAnimState(exSpriteAnimClip _animClip)
    {
        clip       = _animClip;
        name       = _animClip.name;
        wrapMode   = _animClip.wrapMode;
        stopAction = _animClip.stopAction;
        length     = _animClip.length;
        speed      = _animClip.speed;

        frameTimes = new List <float>(_animClip.frameInfos.Count);
        float tmp = 0.0f;

        foreach (exSpriteAnimClip.FrameInfo fi in _animClip.frameInfos)
        {
            tmp += fi.length;
            frameTimes.Add(tmp);
        }
    }
示例#5
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------
    void Init( string _name, exSpriteAnimClip _animClip )
    {
        clip = _animClip;
        name = _name;
        wrapMode = _animClip.wrapMode;
        stopAction = _animClip.stopAction;
        length = _animClip.length;
        speed = _animClip.speed;

        frameTimes = new List<float>(_animClip.frameInfos.Count);
        float tmp = 0.0f;
        for ( int i = 0; i < _animClip.frameInfos.Count; ++i ) {
            tmp += _animClip.frameInfos[i].length;
            frameTimes.Add(tmp);
        }
    }