Class Tile

java.lang.Object
com.takenoko.layers.tile.Tile
Direct Known Subclasses:
Pond

public class Tile extends Object
Class Tile represents a tile in the game. A tile has a type TileType.
  • Field Details

  • Constructor Details

    • Tile

      public Tile()
      Constructor of the class Tile. It creates a tile with the default type OTHER TileType.
    • Tile

      public Tile(TileColor color)
    • Tile

      public Tile(TileType type)
      Constructor of the class Tile. It creates a tile with the given type.
      Parameters:
      type - the type of the tile
    • Tile

      public Tile(TileType type, ImprovementType improvement, TileColor color)
      Constructor of the class Tile. It creates a tile with the given type and improvement.
      Parameters:
      type - the type of the tile
      color - the color of the tile
    • Tile

      public Tile(Tile tile)
      Copy Constructor
      Parameters:
      tile - the tile to copy
    • Tile

      public Tile(ImprovementType improvementType)
    • Tile

      public Tile(ImprovementType improvementType, TileColor tileColor)
  • Method Details

    • getType

      public TileType getType()
      Get the type of the tile.
      Returns:
      the type of the tile
    • getImprovement

      public Optional<ImprovementType> getImprovement()
      Get the improvement of the tile.
      Returns:
      the improvement of the tile
    • setImprovement

      public void setImprovement(ImprovementType improvement)
      Set the improvement of the tile. If the improvement is null, throw an exception.
    • getColor

      public TileColor getColor()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • copy

      public Tile copy()
    • toString

      public String toString()
      Overrides:
      toString in class Object