Example #1
0
 public Boolean MoveTo(Tile destination)
 {
     if (AvailableTiles().Contains(destination))
     {
         Position = destination;
         return true;
     }else
         return false;
 }
Example #2
0
 public Boolean CheckValidTile(Tile t)
 {
     var r = t.X >= 0 &&
            t.Y >= 0 &&
            t.X < Width &&
            t.Y < Height;
     //Console.WriteLine("CheckValid for {0}, it is: {1}, on map: {2}", t, r, this);
     return r;
 }
Example #3
0
        public List<Corner> GetCorners(Tile t)
        {
            List<Corner> corners = new List<Corner>();
            int y;
            int x = t.X;

            if (t.X % 2 == 0)
                y = t.Y;
            else
                y = t.Y + 1;

                corners.Add(new Corner(x, y * 2, this));
                corners.Add(new Corner(x, y * 2 + 1, this));
                corners.Add(new Corner(x, y * 2 + 2, this));
                corners.Add(new Corner(x + 1, y * 2, this));
                corners.Add(new Corner(x + 1, y * 2 + 1, this));
                corners.Add(new Corner(x + 1, y * 2 + 2, this));

            return corners;
        }
Example #4
0
 public Resources getResource(Tile t)
 {
     return resourceMap[t.X][t.Y].Resource;
 }
Example #5
0
 public List<Tile> GetNeighbours(Tile tile)
 {
     return GetNeighbours(tile.X, tile.Y);
 }
Example #6
0
 public Tile GetTile(int x, int y)
 {
     Tile t = new Tile(x, y, this);
     if (CheckValidTile(t))
         return t;
     else
         throw new IndexOutOfRangeException(String.Format("{0}, {1} does not exist in map", x, y));
 }