/// <summary> /// equals override, checks if players are equal /// </summary> public override bool Equals(object obj) { if (obj is SimplePlayer) { SimplePlayer other = (SimplePlayer)obj; return(other.player.Equals(this.player)); } return(false); }
/// <summary> /// finds and returns the simple player in the player list, equal to player /// </summary> private SimplePlayer FindSimplePlayer(SimplePlayer player) { foreach (SimplePlayer pl in players) { if (pl.Equals(player)) { return(pl); } } return(null); }
/// <summary> /// subtracts a card to a simple player /// </summary> internal void SubtractACardFromSimplePlayer(SimplePlayer player) { FindSimplePlayer(player).NumberOfCards--; }
/// <summary> /// adds a card to a simple player /// </summary> internal void AddACardToSimplePlayer(SimplePlayer player) { FindSimplePlayer(player).NumberOfCards++; }