Пример #1
0
    // ------------------------------------------------------------------
    /// Stop the playing animation, take the action that setup in the
    /// exSpriteAnimState.stopAction
    // ------------------------------------------------------------------

    public void Stop(exSpriteAnimationState _animState)
    {
        if (_animState != null)
        {
            if (ReferenceEquals(_animState, curAnimation))
            {
                curAnimation = null;
            }
            _animState.time = 0.0f;

            exSpriteAnimationClip.StopAction stopAction = _animState.stopAction;
            switch (stopAction)
            {
            case exSpriteAnimationClip.StopAction.DoNothing:
                break;

            case exSpriteAnimationClip.StopAction.DefaultSprite:
                sprite_.textureInfo = defaultTextureInfo;
                break;

            case exSpriteAnimationClip.StopAction.Hide:
                sprite_.enabled = false;
                break;

            case exSpriteAnimationClip.StopAction.Destroy:
                Object.Destroy(gameObject);
                break;
            }
        }
#if AUTO_DISABLE
        enabled = false;
#endif
    }
Пример #2
0
    // ------------------------------------------------------------------ 
    /// \param _name the name of the animation state
    /// \param _animClip the referenced animation clip
    /// Constructor of exSpriteAnimState, it will copy the settings from _animClip. 
    // ------------------------------------------------------------------ 

    public exSpriteAnimationState (string _name, exSpriteAnimationClip _animClip) {
        name = _name;
        clip = _animClip;
        wrapMode = clip.wrapMode;
        stopAction = clip.stopAction;
        speed = clip.speed;
        frameInfoFrames = clip.GetFrameInfoFrames();
        if (frameInfoFrames.Length > 0) {
            totalFrames = frameInfoFrames[frameInfoFrames.Length - 1];
        }
        else {
            totalFrames = 0;
        }
        length = totalFrames / clip.frameRate;
        const int MIN_HASH_COUNT = 9;
        if (clip.eventInfos.Count >= MIN_HASH_COUNT) {
            frameToEventDict = clip.GetFrameToEventDict();
        }
    }
Пример #3
0
    // ------------------------------------------------------------------
    /// \param _name the name of the animation state
    /// \param _animClip the referenced animation clip
    /// Constructor of exSpriteAnimState, it will copy the settings from _animClip.
    // ------------------------------------------------------------------

    public exSpriteAnimationState(string _name, exSpriteAnimationClip _animClip)
    {
        name            = _name;
        clip            = _animClip;
        wrapMode        = clip.wrapMode;
        stopAction      = clip.stopAction;
        speed           = clip.speed;
        frameInfoFrames = clip.GetFrameInfoFrames();
        if (frameInfoFrames.Length > 0)
        {
            totalFrames = frameInfoFrames[frameInfoFrames.Length - 1];
        }
        else
        {
            totalFrames = 0;
        }
        length = totalFrames / clip.frameRate;
        const int MIN_HASH_COUNT = 9;

        if (clip.eventInfos.Count >= MIN_HASH_COUNT)
        {
            frameToEventDict = clip.GetFrameToEventDict();
        }
    }