Package model

Class GameFieldModel

java.lang.Object
model.GameFieldModel

public class GameFieldModel extends Object
Implementation of the GameField's logic.
  • Constructor Details

    • GameFieldModel

      public GameFieldModel(Game game)
      Constructs a new GameFieldModel.
      Parameters:
      game - the game reference
  • Method Details

    • getPrice

      public static String getPrice(String unit)
      Returns the price of a Unit.
      Parameters:
      unit - the Unit we query the price of
      Returns:
      the price of the Unit
    • isAttackAnimated

      public static boolean isAttackAnimated(Tower tower)
      Checks if Tower attack is animated.
      Parameters:
      tower - the Tower we query
      Returns:
      true if Tower is attacking, false otherwise
    • isInAttackRange

      public static boolean isInAttackRange(Tower tower, Entity target)
      Checks if Tower has a Solider in attack range.
      Parameters:
      tower - the Tower we query
      target - the target we query
      Returns:
      true if Tower has a Soldier in attack range, false otherwise
    • getWayPoints

      public static ArrayList<Point> getWayPoints()
      Returns the waypoints.
      Returns:
      the waypoints
    • handleWayPoint

      public void handleWayPoint(int xIndex, int yIndex, Entity selection)
      Handle a waypoint.
      Parameters:
      xIndex - x coordinate
      yIndex - y coordinate
      selection - selection Entity
    • delete

      public void delete(int xIndex, int yIndex)
      Deletes an entity.
      Parameters:
      xIndex - x Index
      yIndex - y Index
    • placeEntity

      public void placeEntity(int xIndex, int yIndex, boolean inverted, Types type)
      Places an entity.
      Parameters:
      xIndex - x Index
      yIndex - y Index
      inverted - if the entity is inverted
      type - the type of the entity
    • isEmpty

      public boolean isEmpty(int xIndex, int yIndex, Dimension size)
      Checks if the tile is empty.
      Parameters:
      xIndex - index of the row
      yIndex - index of the column
      size - the size of the Entity
      Returns:
      if the tile is empty
    • deleteBuilding

      public void deleteBuilding(Building building)
      Deletes a building from the Map
      Parameters:
      building - the building to delete