Exemple #1
0
        public override void Update(float gameTime, MainSprite main)
        {
            //talking to dogs
            KeyboardState keyboardState = Keyboard.GetState();

            if (data.Equals("Dave"))
            {
                Console.WriteLine("You reached the exit");
                if (oldState.IsKeyUp(Keys.Enter) && keyboardState.IsKeyDown(Keys.Enter))
                {
                    //lock the character's animation and allow the dialog box to be drawn
                    drawDialog  = true;
                    main.locked = true;
                    dialogReader.nextLine();

                    //reset the dialog reader and unlock character animation once we've reached the end of the dialog
                    if (dialogReader.isDialogDone())
                    {
                        main.locked  = false;
                        drawDialog   = false;
                        dialogReader = new DialogReader();
                        dialogReader.getDialog(@"C:\Users\ember\source\repos\firstrate\Content\TestDialog.txt");
                    }
                }
            }

            if (drawDialog)
            {
                currentDialog = dialogReader.typeLine(animationTimer);
            }

            //check if they are at the exit
            if (data.Equals("Exit"))
            {
                // isDone = true;
                Console.WriteLine("You reached the exit"); //never reaching this point -- have to remember how data is set
            }


            //dog animation
            animationTimer += gameTime;
            if (animationTimer > 450)
            {
                daveAnimation.Update();
                animationTimer = 0;
            }

            oldState = keyboardState;
        }