Пример #1
0
        public override void Update(GameTime gameTime)
        {
            switch (state)
            {
            case (CapeStuckState.draw):
                if (player.sprite.FrameIndex == 5)
                {
                    player.soundEffects["CapeTug"].Play(.5f, 0, 0);
                    state = CapeStuckState.stuck;
                }
                break;

            case (CapeStuckState.stuck):
                // Hold to continue hiding
                //if (player.IsKeyDown(KeyPressed.Attack))
                //{
                if (player.sprite.FrameIndex == 8)
                {
                    player.soundEffects["CapeTug"].Play(.5f, 0, 0);
                    player.sprite.FrameIndex = 6;
                    count++;
                }

                // You're free!
                if (count >= 3)
                {
                    state = CapeStuckState.free;
                    player.isFreeingCape = false;
                }


                //}

                break;

            case (CapeStuckState.free):
                if (player.sprite.FrameIndex == player.animations[key].FrameCount - 1)
                {
                    ChangeState(new StateStopped(player));
                }
                break;
            }
            base.Update(gameTime);
        }
Пример #2
0
        int count = 0; // how many tugs of the cape?

        public StateCapeStuck(int itemIndex, BoxingPlayer player)
            : base(player, "CapeStuck")
        {
            state = CapeStuckState.draw;
        }