コード例 #1
0
ファイル: Player.cs プロジェクト: 7ashish/Monopoly
 //This function checks whether this player owns a specific city or not.
 //returns true if he owns it and false if not.
 public bool IsCityOwned(City city)
 {
     if (OwnedCities.Contains(city))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: 7ashish/Monopoly
 //This function buys a specific city.
 public bool Buy_City(City city)
 {
     if (Balance >= city.Price)
     {
         BalanceFeedback = 0;
         OwnedCities.Add(city);
         Balance         -= city.Price;
         BalanceFeedback -= city.Price;
         city.Owned       = true;
         city.Owner       = this;
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #3
0
ファイル: Player.cs プロジェクト: 7ashish/Monopoly
    //This Function Checks if the player owns the whole Group of Cities or not.
    public bool IsGroupOwned(City city, Monopoly_Master Temp)
    {
        bool owned     = false;
        var  ThisGroup = (List <City>)Temp.Groups[city.GroupNumber];

        foreach (City GroupCity in ThisGroup)
        {
            if (OwnedCities.Contains(GroupCity))
            {
                owned = true;
            }
            else
            {
                owned = false;
                break;
            }
        }
        return(owned);
    }