Exemplo n.º 1
0
        /// <summary>
        /// Set the animation state. Will only have an effect if stateName is different from current animation stateName.
        /// </summary>
        public void SetState(string stateName)
        {
            if (animations.ContainsKey(stateName) == false)
            {
                Debug.ULogErrorChannel("Animation", "SetState tries to set " + stateName + " which doesn't exist.");
                return;
            }

            if (stateName != currentAnimationState)
            {
                currentAnimationState = stateName;
                currentAnimation      = animations[currentAnimationState];
                currentAnimation.Play();
                ShowSprite(currentAnimation.CurrentFrameName);
            }
        }
        /// <summary>
        /// Set the animation state. Will only have an effect if stateName is different from current animation stateName.
        /// </summary>
        public void SetState(string stateName)
        {
            if (animations.ContainsKey(stateName) == false)
            {
                return;
            }

            if (stateName == currentAnimationState)
            {
                return;
            }

            currentAnimationState = stateName;
            currentAnimation      = animations[currentAnimationState];
            currentAnimation.Play();
            ShowSprite(currentAnimation.CurrentFrameName);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Set the animation state. Will only have an effect if stateName is different from current animation stateName.
        /// </summary>
        public void SetState(string stateName)
        {
            if (stateName == currentAnimationState)
            {
                return;
            }

            SpritenameAnimation animation;

            if (animations.TryGetValue(stateName, out animation) == false)
            {
                return;
            }

            currentAnimationState = stateName;
            currentAnimation      = animation;
            currentAnimation.Play();
            ShowSprite(currentAnimation.CurrentFrameName);
        }