Package model

Class Terrain

java.lang.Object
model.Terrain
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Desert, Mountain, Plains, Swamp

public abstract class Terrain extends Object implements Serializable
Implementation of Terrain class.
See Also:
  • Field Details

    • entities

      protected ArrayList<Entity> entities
      An ArrayList of Entities on the tile.
    • type

      protected final Types type
      The type of the tile.
    • speedMod

      protected int speedMod
      The speed modifier of the tile.
    • tileVersion

      protected final int tileVersion
      The version of the tile.
  • Constructor Details

    • Terrain

      protected Terrain(Types type)
      Constructs a new Terrain instance without entities.
      Parameters:
      type - the type of tile
    • Terrain

      protected Terrain(Types type, ArrayList<Entity> entities)
      Constructs a new Terrain instance without entities.
      Parameters:
      type - the type of tile
      entities - an ArrayList containing the entities
  • Method Details

    • getTileVersion

      public int getTileVersion()
      Returns the version of the tile.
      Returns:
      the version of the tile
    • getEntities

      public ArrayList<Entity> getEntities()
      Returns the entities on the tile in an ArrayList.
      Returns:
      the entities on the tile in an ArrayList
    • setEntities

      public void setEntities(ArrayList<Entity> entities)
      Sets the entities on the tile with an ArrayList.
      Parameters:
      entities - the entities to set on the tile in an ArrayList
    • addEntities

      public void addEntities(Entity entity)
      Adds a new Entity to the tile
      Parameters:
      entity - a new Entity to add
    • getType

      public Types getType()
      Returns the type of the tile.
      Returns:
      the type of the tile
    • getSpeedMod

      public int getSpeedMod()
      Returns the speed modifier of the tile.
      Returns:
      the speed modifier of the tile