コード例 #1
0
        public void PlayAnimation(string name)
        {
            if (sprite_renderer == null)
            {
                return;
            }

            if (playing_animation != null)
            {
                if (playing_animation.Name == name)
                {
                    return;
                }
            }

            Animation2D animation_to_play = GetAnimation(name);

            if (animation_to_play == null)
            {
                return;
            }

            playing_animation = animation_to_play;
            playing_animation_needs_to_start = true;
        }
コード例 #2
0
        private Animation2D GetAnimation(string animation_name)
        {
            if (animation_pack == null)
            {
                return(null);
            }

            for (int i = 0; i < animation_pack.Animations.Count; ++i)
            {
                Animation2D curr_animation = animation_pack.Animations[i];

                if (curr_animation.Name == animation_name)
                {
                    return(curr_animation);
                }
            }

            return(null);
        }