Exemple #1
0
    public void HandleAlways(string input)
    {
        if (output.Count == 0 && input.Equals("be me"))
        {
            output.Add("still me");
        }

        if (input.Equals("lift cape"))
        {
            if (this.capeState == CapeState.Down)
            {
                output.Add("I lift my cape");
                this.capeState = CapeState.Up;
            }
            else
            {
                output.Add("my cape is still slowly floating down");
            }
        }

        if (output.Count == 0 && input.Equals("talk"))
        {
            output.Add("talk to whom?");
        }
    }
Exemple #2
0
        KeyPressed itemButton; // the button mapped to this item

        public StateCape(int itemIndex, BoxingPlayer player, KeyPressed key)
            : base(player, "Cape")
        {
            this.itemIndex = itemIndex;
            state          = CapeState.draw;

            this.itemButton = key;
        }
Exemple #3
0
 public void ResetGame()
 {
     this.locationState = LocationStates.NotStarted;
     this.dogState      = DogState.Ignored;
     this.capeState     = CapeState.Down;
     this.talkingToGirl = false;
     this.fallingInLove = 0;
     SchoolLocation.Instance.Reset();
 }
Exemple #4
0
        public override void Update(GameTime gameTime)
        {
            if (player.isFreeingCape)
            {
                ChangeState(new StateCapeStuck(itemIndex, player));
            }

            switch (state)
            {
            case (CapeState.draw):
                if (!hasPlayedSound)
                {
                    PlaySound(player.soundEffects["CapeDraw"], .5f);
                }
                if (player.sprite.FrameIndex == 9)
                {
                    state = CapeState.hide;
                }
                break;

            case (CapeState.hide):
                // Hold to continue hiding
                if (player.IsKeyDown(itemButton))
                {
                    player.sprite.FrameIndex = 9;

                    bool behind = false;

                    if (player.IsKeyDown(KeyPressed.Left))
                    {
                        int dir = player.direction;
                        if (player.direction == 1)
                        {
                            dir = -1;
                        }
                        targetPlayer = player.BoxingManager.GetPlayerInFront(player, player.position.Y - 2 * player.GetHeight / 3, dir);
                        if (targetPlayer != null)
                        {
                            target = targetPlayer.position.X - 18 * BoxingPlayer.Scale;
                        }

                        direction = dir;
                    }
                    else if (player.IsKeyDown(KeyPressed.Right))
                    {
                        int dir = player.direction;
                        if (player.direction == -1)
                        {
                            dir = 1;
                        }
                        targetPlayer = player.BoxingManager.GetPlayerInFront(player, player.position.Y - 2 * player.GetHeight / 3, dir);
                        if (targetPlayer != null)
                        {
                            target = targetPlayer.position.X + 18 * BoxingPlayer.Scale;
                        }

                        direction = dir;
                    }
                    if (targetPlayer != null)
                    {
                        player.soundEffects["Cape"].Play(.5f, 0, 0);    // play the sound effect!
                        state = CapeState.travel;
                        player.ChangeDirection(direction * -1);
                    }
                }
                else if (!exiting)
                {
                    player.sprite.FrameIndex = 16;
                    state = CapeState.reveal;
                }
                break;

            case (CapeState.reveal):
                if (player.sprite.FrameIndex == player.animations[key].FrameCount - 1)
                {
                    if (traveled)
                    {
                        player.isFreeingCape = true;
                    }
                    ChangeState(new StateStopped(player));
                }
                break;

            case (CapeState.travel):

                if (player.sprite.FrameIndex == 15)
                {
                    player.sprite.FrameIndex = 13;
                }



                player.position.X += (float)(direction * speed * gameTime.ElapsedGameTime.TotalSeconds);
                float dif = Math.Abs(player.position.X - target);
                // You're behind'm!
                if (dif < 5 && dif > 0 ||
                    player.position.X - player.GetWidth / 2 <= player.BoxingManager.bounds.X ||
                    player.position.X + player.GetWidth / 2 >= player.BoxingManager.bounds.X + player.BoxingManager.bounds.Width
                    )
                {
                    state    = CapeState.reveal;
                    traveled = true;
                }

                break;
            }

            base.Update(gameTime);
        }