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 CubeCoordinatecenterCenter of the build area (likely 0)intradiusMax 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 booleancontains(CubeCoordinate coord)Checks if a coordinate is on the build area.static BuildAreadeserialize(org.json.JSONObject data)deserializes a build area from jsonCubeCoordinategetCenter()Returns the center of the build area.intgetRadius()The hexagon radius of the build area.java.util.Iterator<CubeCoordinate>iterator()java.lang.StringtoString()
-
-
-
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. Usecontainsto 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:
iteratorin interfacejava.lang.Iterable<CubeCoordinate>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-