Advertisement
Guest User

Locations

a guest
Mar 16th, 2016
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Mono_Poly
  8. {
  9.     public interface ILocation
  10.     {
  11.         string Name { get; }
  12.         int Position { get; }
  13.  
  14.         void LandOn(Player player);
  15.     }
  16.  
  17.     public interface IProperty
  18.     {
  19.         string Name { get; }
  20.         int Position { get; }
  21.         int Cost { get; }
  22.         int Rent { get; }
  23.         string Color { get; }
  24.         Player Owner { get; }
  25.  
  26.         void LandOn(Player player);
  27.     }
  28.  
  29.  
  30.     public class Property : ILocation, IProperty
  31.     {
  32.         public string Name { get; }
  33.         public int Position { get; }
  34.         public int Cost { get; }
  35.         public int Rent { get; }
  36.         public string Color { get; }
  37.         public Player Owner { get; }
  38.         // Function = player.Money -= Rent (if not owner)
  39.  
  40.         public Property(string name, int position, int cost, int rent, string color, Player owner)
  41.         {
  42.             Name = name;
  43.             Position = position;
  44.             Cost = cost;
  45.             Rent = rent;
  46.             Color = color;
  47.             Owner = owner;
  48.         }
  49.  
  50.         public void LandOn(Player player)
  51.         {
  52.             player.Money -= Rent;
  53.         }
  54.     }
  55.  
  56.     public class Railyway : ILocation, IProperty
  57.     {
  58.         public string Name { get; }
  59.         public int Position { get; }
  60.         public int Cost { get; }
  61.         public int Rent { get; }
  62.         public string Color { get; }
  63.         public Player Owner { get; }
  64.  
  65.         public Railyway(string name, int position, int cost, int rent, string color, Player owner)
  66.         {
  67.             Name = name;
  68.             Position = position;
  69.             Cost = cost;
  70.             Rent = rent;
  71.             Color = color;
  72.             Owner = owner;
  73.         }
  74.  
  75.         public void LandOn(Player player)
  76.         {
  77.             /*
  78.             if owner owns one railway
  79.                 player.Money -= Rent;
  80.             if owner owns two
  81.                 player.Money -= 50
  82.             if owner owns three
  83.                 player.Money -= 100
  84.             if owner owns four
  85.                 player.Money -= 200
  86.             */
  87.         }
  88.     }
  89.  
  90.     public class Utility : ILocation, IProperty
  91.     {
  92.         public string Name { get; }
  93.         public int Position { get; }
  94.         public int Cost { get; }
  95.         public int Rent { get; }
  96.         public string Color { get; }
  97.         public Player Owner { get; }
  98.  
  99.         public Utility(string name, int position, int cost, int rent, string color, Player owner)
  100.         {
  101.             Name = name;
  102.             Position = position;
  103.             Cost = cost;
  104.             Rent = rent;
  105.             Color = color;
  106.             Owner = owner;
  107.         }
  108.  
  109.         public void LandOn(Player player)
  110.         {
  111.             // player.Money -= rent * DiceRoll
  112.             // or if owner also owns other company
  113.             // player.Money -= 10 * DiceRoll
  114.         }
  115.     }
  116.  
  117.     public class Go : ILocation
  118.     {
  119.         public string Name { get; }
  120.         public int Position { get; }
  121.  
  122.         public Go()
  123.         {
  124.             Name = "Go";
  125.             Position = 0;
  126.         }
  127.  
  128.         public void LandOn(Player player)
  129.         {
  130.             player.Money += 200;
  131.         }
  132.     }
  133.  
  134.     public class Card : ILocation
  135.     {
  136.         public string Name { get; }
  137.         public int Position { get; }
  138.  
  139.         public Card(string name, int position)
  140.         {
  141.             Name = name;
  142.             Position = position;
  143.         }
  144.  
  145.         public void LandOn(Player player)
  146.         {
  147.            // Draw card
  148.         }
  149.     }
  150.  
  151.     public class Jail : ILocation
  152.     {
  153.         public string Name { get; }
  154.         public int Position { get; }
  155.  
  156.         public Jail(string name, int position)
  157.         {
  158.             Name = name;
  159.             Position = position;
  160.         }
  161.  
  162.         public void LandOn(Player player)
  163.         {
  164.             // Nothing
  165.         }
  166.     }
  167.  
  168.     public class FreeParking : ILocation
  169.     {
  170.         public string Name { get; }
  171.         public int Position { get; }
  172.  
  173.         public FreeParking(string name, int position)
  174.         {
  175.             Name = name;  
  176.             Position = position;
  177.         }
  178.  
  179.         public void LandOn(Player player)
  180.         {
  181.             // Nothing
  182.         }
  183.     }
  184.  
  185.     public class GoToJail : ILocation
  186.     {
  187.         public string Name { get; }
  188.         public int Position { get; }
  189.  
  190.         public GoToJail(string name, int position)
  191.         {
  192.             Name = name;
  193.             Position = position;
  194.         }
  195.  
  196.         public void LandOn(Player player)
  197.         {
  198.             player.InJail = true;
  199.         }
  200.     }
  201.    
  202. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement