Пример #1
0
 public void Update(GameTime gameTime, KeyboardState kb, KeyboardState oldkb)
 {
     if (isDialogVisable)
     {
         curTreeLoc.Value.update(gameTime, kb, oldkb);
         player.CanWalk = false;
         if (curTreeLoc.Value.EnterPressed && curTreeLoc.Value.isDone)
         {
             if (curTreeLoc.Value.hasChoices())
             {
                 choiceMaker     = new DialogueChoices(sb, content, curTreeLoc.Value.Choices, Game1.graphics);
                 isDialogVisable = false;
                 isChoiceVisable = true;
             }
             else
             {
                 choiceMaker     = null;
                 isDialogVisable = false;
                 isChoiceVisable = false;
                 player.CanWalk  = true;
                 Tile.count++;
                 MediaPlayer.Play(Game1.song1);
             }
         }
     }
     if (isChoiceVisable)
     {
         if (nextframe)
         {
             player.CanWalk = false;
             choiceMaker.Update(kb, oldkb);
             if (choiceMaker.choiceChosen != -1)
             {
                 if (curTreeLoc.Children.Count > 0)
                 {
                     curTreeLoc = curTreeLoc[choiceMaker.choiceChosen];
                 }
                 Console.WriteLine("chosen");
                 isChoiceVisable = false;
                 isDialogVisable = true;
                 nextframe       = false;
             }
         }
         else
         {
             count++;
             if (count == 15)
             {
                 nextframe = !nextframe;
                 count     = 0;
             }
         }
         player.CanWalk = false;
     }
 }
Пример #2
0
 public TreeHelper(DialogTree <DialogBox> dT, SpriteBatch sb, ContentManager content, GraphicsDeviceManager graphics, Player p)
 {
     this.dT         = dT;
     curTreeLoc      = dT;
     isDialogVisable = false;
     isChoiceVisable = false;
     count           = 0;
     nextframe       = false;
     this.sb         = sb;
     this.content    = content;
     choiceMaker     = new DialogueChoices(sb, content, curTreeLoc.Value.Choices, graphics);
     player          = p;
 }