Package model
Class GameFieldModel
java.lang.Object
model.GameFieldModel
Implementation of the GameField's logic.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
delete
(int xIndex, int yIndex) Deletes an entity.void
deleteBuilding
(Building building) Deletes a building from the Mapstatic String
Returns the price of a Unit.Returns the waypoints.void
handleWayPoint
(int xIndex, int yIndex, Entity selection) Handle a waypoint.static boolean
isAttackAnimated
(Tower tower) Checks if Tower attack is animated.boolean
Checks if the tile is empty.static boolean
isInAttackRange
(Tower tower, Entity target) Checks if Tower has a Solider in attack range.void
placeEntity
(int xIndex, int yIndex, boolean inverted, Types type) Places an entity.
-
Constructor Details
-
GameFieldModel
Constructs a new GameFieldModel.- Parameters:
game
- the game reference
-
-
Method Details
-
getPrice
Returns the price of a Unit.- Parameters:
unit
- the Unit we query the price of- Returns:
- the price of the Unit
-
isAttackAnimated
Checks if Tower attack is animated.- Parameters:
tower
- the Tower we query- Returns:
- true if Tower is attacking, false otherwise
-
isInAttackRange
Checks if Tower has a Solider in attack range.- Parameters:
tower
- the Tower we querytarget
- the target we query- Returns:
- true if Tower has a Soldier in attack range, false otherwise
-
getWayPoints
Returns the waypoints.- Returns:
- the waypoints
-
handleWayPoint
Handle a waypoint.- Parameters:
xIndex
- x coordinateyIndex
- y coordinateselection
- selection Entity
-
delete
public void delete(int xIndex, int yIndex) Deletes an entity.- Parameters:
xIndex
- x IndexyIndex
- y Index
-
placeEntity
Places an entity.- Parameters:
xIndex
- x IndexyIndex
- y Indexinverted
- if the entity is invertedtype
- the type of the entity
-
isEmpty
Checks if the tile is empty.- Parameters:
xIndex
- index of the rowyIndex
- index of the columnsize
- the size of the Entity- Returns:
- if the tile is empty
-
deleteBuilding
Deletes a building from the Map- Parameters:
building
- the building to delete
-