Exemple #1
0
 // Added By: Jeffrey Rackauckas
 // Added on: 4/30/2014
 // Purpose: Let's the user buy a hat!
 public int BuyHat(Hat toBuy)
 {
     if (toBuy.getPrice() > this.Coins) return 1;
     if (ownsHat(toBuy)) return 2;
     this.Coins -= toBuy.getPrice();
     this.OwnedHats.Add(toBuy);
     return 0;
 }
Exemple #2
0
 public bool ownsHat(Hat toCheck){
     foreach(Data.Hat hat in this.OwnedHats)
     {
         if(hat.Tier == toCheck.Tier && hat.Number == toCheck.Number) return true;
     }
     return false;
 }