Class BuildArea
- java.lang.Object
-
- page.codeberg.terratactician_expandoria.world.BuildArea
-
- All Implemented Interfaces:
java.lang.Iterable<CubeCoordinate>
public class BuildArea extends java.lang.Object implements java.lang.Iterable<CubeCoordinate>
The BuildArea describes the area where tiles are placable.
-
-
Field Summary
Fields Modifier and Type Field Description CubeCoordinate
center
Center of the build area (likely 0)int
radius
Max build radius of the build area.
-
Constructor Summary
Constructors Constructor Description BuildArea()
Creates a empty build area.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(CubeCoordinate coord)
Checks if a coordinate is on the build area.static BuildArea
deserialize(org.json.JSONObject data)
deserializes a build area from jsonCubeCoordinate
getCenter()
Returns the center of the build area.int
getRadius()
The hexagon radius of the build area.java.util.Iterator<CubeCoordinate>
iterator()
java.lang.String
toString()
-
-
-
Field Detail
-
center
public CubeCoordinate center
Center of the build area (likely 0)
-
radius
public int radius
Max build radius of the build area.
-
-
Method Detail
-
deserialize
public static BuildArea deserialize(org.json.JSONObject data)
deserializes a build area from json- Parameters:
data
- json data- Returns:
- deserialized BuildArea
-
getRadius
public int getRadius()
The hexagon radius of the build area. The radius defines the Ring (see RingIterator) just outside the build area, centered around centered. Usecontains
to check if a coordinate is inside the build area.- Returns:
- radius of the build area
-
getCenter
public CubeCoordinate getCenter()
Returns the center of the build area.- Returns:
- center of the build area
-
contains
public boolean contains(CubeCoordinate coord)
Checks if a coordinate is on the build area.- Parameters:
coord
- coordinate to check- Returns:
- whether the coordinate is in the build area
-
iterator
public java.util.Iterator<CubeCoordinate> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<CubeCoordinate>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-