示例#1
0
文件: User.cs 项目: jeffreyrack/hodor
 // 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;
 }
示例#2
0
文件: User.cs 项目: jeffreyrack/hodor
 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;
 }