示例#1
0
        public TestScreen()
        {
            animationLookup = new Dictionary <AnimationId, AnimationContainer>();

            AnimationContainer container;

            container       = new AnimationContainer();
            container.up    = GetAnimation(A.anim_stand_north);
            container.down  = GetAnimation(A.anim_stand_south);
            container.left  = GetAnimation(A.anim_stand_west);
            container.right = GetAnimation(A.anim_stand_east);
            animationLookup[AnimationId.Stand] = container;

            container       = new AnimationContainer();
            container.up    = GetAnimation(A.anim_walk_north);
            container.down  = GetAnimation(A.anim_walk_south);
            container.left  = GetAnimation(A.anim_walk_west);
            container.right = GetAnimation(A.anim_walk_east);
            animationLookup[AnimationId.Walk] = container;

            container       = new AnimationContainer();
            container.up    = GetAnimation(A.anim_kick_north);
            container.down  = GetAnimation(A.anim_kick_south);
            container.left  = GetAnimation(A.anim_kick_west);
            container.right = GetAnimation(A.anim_kick_east);
            animationLookup[AnimationId.Kick] = container;

            groupInstance = new AnimationInstance();
            groupInstance.Init(GetAnimation(A.anim_die_green_1));
        }
示例#2
0
        private void UpdateAnimation()
        {
            PlayerAnimations.Id    id;
            PlayerAnimations.Id    currentId = (PlayerAnimations.Id)m_currentAnimation.id;
            AnimationInstance.Mode mode      = AnimationInstance.Mode.Looped;

            if (IsAlive)
            {
                if (IsPunchingBomb)
                {
                    if (currentId == PlayerAnimations.Id.PunchBomb)
                    {
                        return; // don't play animation again
                    }

                    id   = PlayerAnimations.Id.PunchBomb;
                    mode = AnimationInstance.Mode.Normal;
                }
                else if (IsPickingUpBomb)
                {
                    id   = PlayerAnimations.Id.PickupBomb;
                    mode = AnimationInstance.Mode.Normal;
                }
                else if (IsHoldingBomb())
                {
                    id   = IsMoving() ? PlayerAnimations.Id.WalkBomb : PlayerAnimations.Id.StandBomb;
                    mode = AnimationInstance.Mode.Normal;
                }
                else if (IsMoving())
                {
                    id = PlayerAnimations.Id.Walk;
                    Animation newAnimation = m_animations.Find(id, direction);
                    if (m_currentAnimation.Animation == newAnimation)
                    {
                        return;
                    }
                }
                else
                {
                    id = PlayerAnimations.Id.Stand;
                }
            }
            else
            {
                id   = PlayerAnimations.Id.Die;
                mode = AnimationInstance.Mode.Normal;
            }

            Animation animation = m_animations.Find(id, direction);

            m_currentAnimation.Init(animation, mode);
            m_currentAnimation.id = (int)id;
            m_currentAnimation.animationDelegate = AnimationFinishedCallback;
        }
示例#3
0
        private void UpdateAnimation()
        {
            if (m_animations != null)
            {
                BombAnimations.AnimationType type;
                if (isTrigger)
                {
                    type = BombAnimations.AnimationType.Trigger;
                }
                else if (IsJelly())
                {
                    type = BombAnimations.AnimationType.Jelly;
                }
                else
                {
                    type = BombAnimations.AnimationType.Default;
                }

                Animation animation = m_animations.Find(type);
                m_currentAnimation.Init(animation);
            }
        }