using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Mono_Poly { public interface ILocation { string Name { get; } int Position { get; } void LandOn(Player player); } public interface IProperty { string Name { get; } int Position { get; } int Cost { get; } int Rent { get; } string Color { get; } Player Owner { get; } void LandOn(Player player); } public class Property : ILocation, IProperty { public string Name { get; } public int Position { get; } public int Cost { get; } public int Rent { get; } public string Color { get; } public Player Owner { get; } // Function = player.Money -= Rent (if not owner) public Property(string name, int position, int cost, int rent, string color, Player owner) { Name = name; Position = position; Cost = cost; Rent = rent; Color = color; Owner = owner; } public void LandOn(Player player) { player.Money -= Rent; } } public class Railyway : ILocation, IProperty { public string Name { get; } public int Position { get; } public int Cost { get; } public int Rent { get; } public string Color { get; } public Player Owner { get; } public Railyway(string name, int position, int cost, int rent, string color, Player owner) { Name = name; Position = position; Cost = cost; Rent = rent; Color = color; Owner = owner; } public void LandOn(Player player) { /* if owner owns one railway player.Money -= Rent; if owner owns two player.Money -= 50 if owner owns three player.Money -= 100 if owner owns four player.Money -= 200 */ } } public class Utility : ILocation, IProperty { public string Name { get; } public int Position { get; } public int Cost { get; } public int Rent { get; } public string Color { get; } public Player Owner { get; } public Utility(string name, int position, int cost, int rent, string color, Player owner) { Name = name; Position = position; Cost = cost; Rent = rent; Color = color; Owner = owner; } public void LandOn(Player player) { // player.Money -= rent * DiceRoll // or if owner also owns other company // player.Money -= 10 * DiceRoll } } public class Go : ILocation { public string Name { get; } public int Position { get; } public Go() { Name = "Go"; Position = 0; } public void LandOn(Player player) { player.Money += 200; } } public class Card : ILocation { public string Name { get; } public int Position { get; } public Card(string name, int position) { Name = name; Position = position; } public void LandOn(Player player) { // Draw card } } public class Jail : ILocation { public string Name { get; } public int Position { get; } public Jail(string name, int position) { Name = name; Position = position; } public void LandOn(Player player) { // Nothing } } public class FreeParking : ILocation { public string Name { get; } public int Position { get; } public FreeParking(string name, int position) { Name = name; Position = position; } public void LandOn(Player player) { // Nothing } } public class GoToJail : ILocation { public string Name { get; } public int Position { get; } public GoToJail(string name, int position) { Name = name; Position = position; } public void LandOn(Player player) { player.InJail = true; } } }