コード例 #1
0
ファイル: Player.cs プロジェクト: rishikavikondala/wumpus2018
 public bool WumpTrivia()
 {
     //call trivia
     //Iff the user gets two out of the three questions asked right, they will be given intel
     this.numRight     = 0;
     this.numQuestions = 0;
     while (this.numRight < 3 && this.numQuestions < 5)
     {
         this.gold--;
         using (var form = new TriviaForm())
         {
             var result = form.ShowDialog();
             if (result == System.Windows.Forms.DialogResult.OK)
             {
                 this.numRight += form.correct;
             }
         }
         this.numQuestions++;
     }
     if (this.numRight == 3)
     {
         updateScore();
         return(true);
     }
     updateScore();
     return(false);
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: rishikavikondala/wumpus2018
 public bool purchaseArrows()
 {
     //call trivia class and ask two questions and return if they got
     //at least 2 or more correct
     this.numRight     = 0;
     this.numQuestions = 0;
     while (this.numRight < 2 && this.numQuestions < 3)
     {
         this.gold--;
         using (var form = new TriviaForm())
         {
             var result = form.ShowDialog();
             if (result == System.Windows.Forms.DialogResult.OK)
             {
                 this.numRight += form.correct;
             }
         }
         this.numQuestions++;
     }
     if (this.numRight == 2)
     {
         this.arrows = this.arrows + 2;
         updateScore();
         return(true);
     }
     updateScore();
     return(false);
 }