public class Tile
extends com.badlogic.gdx.scenes.scene2d.ui.Button
Modifier and Type | Field and Description |
---|---|
boolean |
chancellorTextureVisible |
private Drawer |
drawer
Object defining QOL drawing functions for rectangles and on-screen tables
Used in this class to render tooltip regions
|
private int |
EnergyCount
A modifier influencing how much energy is produced.
|
private int |
FoodCount
A modifier influencing how much food is produced.
|
private com.badlogic.gdx.Game |
game
Holds game-state for the purpose of accessing the game's renderer
|
private int |
ID
Uniquely identifies the tile
|
private int |
OreCount
A modifier influencing how much ore is produced.
|
private Player |
owner
The player that owns the tile, if it has one.
|
private Roboticon |
roboticonStored
The roboticon that has been placed on the tile.
|
private java.lang.Runnable |
runnable
Object holding executable method that can be assigned to the tile
|
private com.badlogic.gdx.graphics.Color |
tileBorderColor
Holds the colour of the border to be drawn over the tile when it is claimed
|
private int |
tileBorderThickness
Determines the thickness of the tile's border (in pixels)
|
private static int |
tileXOffset |
private boolean |
tooltipActive
Boolean variable that's true whenever the tile's tooltip is visible and false otherwise
|
private int |
tooltipCursorSpace
Defines distance (in pixels) from cursor point to the lower-right (or upper-right) corner of the tile's tooltip
(on both axes)
|
private com.badlogic.gdx.graphics.Color |
tooltipFillColor
Defines the fill-colour for the tile's tooltip
|
private TTFont |
tooltipFont
Defines the font of the text inside the tile's tooltip
|
private TTFont |
tooltipFont2 |
private int |
tooltipHeightLine1 |
private int |
tooltipHeightLine2 |
private int |
tooltipHeightTotal
Defines height of each text line in tooltip and total sum of heights
|
private com.badlogic.gdx.graphics.Color |
tooltipLineColor
Defines the line-colour for the tile's tooltip
|
private int |
tooltipTextSpace
Defines internal padding within the tile's tooltip (in pixels)
|
private int |
tooltipWidth
Defines width of the tile's tooltip
|
Constructor and Description |
---|
Tile(com.badlogic.gdx.Game game,
GameEngine engine,
int ID,
int EnergyCount,
int OreCount,
int FoodCount,
boolean landmark,
java.lang.Runnable runnable)
Construct's the tile's visual interface and logical underpinnings.
|
Modifier and Type | Method and Description |
---|---|
void |
assignRoboticon(Roboticon roboticon)
Adds a Roboticon to the roboticon list.
|
boolean |
chancellorIsVisible() |
void |
changeEnergyCount(int Count)
Setter for the ore count of the tile.
|
void |
changeFoodCount(int count) |
void |
changeOreCount(int Count)
Setter for the ore count of the tile.
|
void |
drawBorder()
Draws the tile's coloured border on the game's stage
This must be called during the construction of each frame in which the border is to be shown
Note that the border must only be shown if the tile is owned by someone
|
void |
drawTooltip()
Draws the tile's tooltip on the game's stage
Specifically draws the tooltip region in the space to the top- or bottom-left of the cursor's position
(depending on how high up the cursor is in the game's window) before drawing textual and visual contents inside
that region
This must be called during the construction of each frame in which the tooltip is to be shown
|
int |
getEnergyCount() |
int |
getFoodCount() |
java.lang.Runnable |
getFunction()
Returns the tile's associated function
|
int |
getID()
Returns the tile's associated getID value
|
int |
getOreCount() |
Player |
getOwner()
Returns the class of the player who owns the tile
|
Roboticon |
getRoboticonStored()
Retuns the Roboticon assigned to this tile
|
boolean |
hasRoboticon()
Returns a value that's true if a Roboticon is assigned to the tile, and false otherwise
|
void |
hidechancellorTexture()
Removes the chancellor from the tile
|
boolean |
isOwned()
Returns a boolean value that's true if/when the tile is owned by a player and false otherwise
|
void |
produce()
Calculates how many resources are produced based on the amount of roboticons present and adds them to the player.
|
void |
runFunction()
Runs the tile's associated function
|
void |
setOwner(Player Owner)
Changes the owner of the tile to the one specified
|
void |
setResource(java.lang.String Resource,
int quantity)
Sets a certain resource count to the specified amount.
|
void |
setTileBorderColor(com.badlogic.gdx.graphics.Color color)
Sets the colour of the tile's border
This must only be called if and when a player acquires the tile
|
void |
showchancellorTexture()
Adds a chancellor to the tile
|
com.badlogic.gdx.graphics.Color |
tileBorderColor()
Returns the colour of the tile's border
|
void |
unassignRoboticon(Roboticon Roboticon)
Removes the first instance of the roboticon from the list.
|
draw, getButtonGroup, getClickListener, getMinHeight, getMinWidth, getPrefHeight, getPrefWidth, getStyle, isChecked, isDisabled, isOver, isPressed, setChecked, setDisabled, setProgrammaticChangeEvents, setStyle, toggle
add, add, add, add, add, add, add, align, background, background, bottom, center, clearChildren, columnDefaults, debug, debug, debugActor, debugAll, debugCell, debugTable, defaults, drawBackground, drawDebug, drawDebugBounds, getAlign, getBackground, getCell, getCells, getClip, getColumns, getColumnWidth, getPadBottom, getPadBottomValue, getPadLeft, getPadLeftValue, getPadRight, getPadRightValue, getPadTop, getPadTopValue, getPadX, getPadY, getRow, getRowHeight, getRows, getSkin, getTableDebug, hit, invalidate, layout, left, pad, pad, pad, pad, padBottom, padBottom, padLeft, padLeft, padRight, padRight, padTop, padTop, removeActor, removeActor, reset, right, row, setBackground, setBackground, setClip, setDebug, setRound, setSkin, stack, top
childrenChanged, getMaxHeight, getMaxWidth, invalidateHierarchy, needsLayout, pack, setFillParent, setLayoutEnabled, sizeChanged, validate
act, addActor, addActorAfter, addActorAt, addActorBefore, applyTransform, applyTransform, clear, computeTransform, drawChildren, drawDebugChildren, findActor, getChildren, getCullingArea, hasChildren, isTransform, localToDescendantCoordinates, resetTransform, resetTransform, setCullingArea, setDebug, setStage, setTransform, swapActor, swapActor, toString
addAction, addCaptureListener, addListener, clearActions, clearListeners, clipBegin, clipBegin, clipEnd, fire, getActions, getCaptureListeners, getColor, getDebug, getHeight, getListeners, getName, getOriginX, getOriginY, getParent, getRight, getRotation, getScaleX, getScaleY, getStage, getTop, getTouchable, getUserObject, getWidth, getX, getX, getY, getY, getZIndex, hasActions, hasParent, isAscendantOf, isDescendantOf, isTouchable, isVisible, localToAscendantCoordinates, localToParentCoordinates, localToStageCoordinates, moveBy, notify, parentToLocalCoordinates, positionChanged, remove, removeAction, removeCaptureListener, removeListener, rotateBy, rotationChanged, scaleBy, scaleBy, screenToLocalCoordinates, setBounds, setColor, setColor, setHeight, setName, setOrigin, setOrigin, setOriginX, setOriginY, setParent, setPosition, setPosition, setRotation, setScale, setScale, setScaleX, setScaleY, setSize, setTouchable, setUserObject, setVisible, setWidth, setX, setY, setZIndex, sizeBy, sizeBy, stageToLocalCoordinates, toBack, toFront
private final int tooltipWidth
private final int tooltipHeightTotal
private final int tooltipHeightLine1
private final int tooltipHeightLine2
private final int tooltipCursorSpace
private final int tooltipTextSpace
private final com.badlogic.gdx.graphics.Color tooltipFillColor
private final com.badlogic.gdx.graphics.Color tooltipLineColor
private final TTFont tooltipFont
private final TTFont tooltipFont2
private com.badlogic.gdx.Game game
private int ID
private int EnergyCount
private int FoodCount
private int OreCount
private Player owner
private Roboticon roboticonStored
private java.lang.Runnable runnable
private Drawer drawer
private boolean tooltipActive
private com.badlogic.gdx.graphics.Color tileBorderColor
private int tileBorderThickness
public boolean chancellorTextureVisible
private static final int tileXOffset
public Tile(com.badlogic.gdx.Game game, GameEngine engine, int ID, int EnergyCount, int OreCount, int FoodCount, boolean landmark, java.lang.Runnable runnable)
game
- Variable storing the game's stateID
- The tile's distictive getID valueEnergyCount
- The multiplier for the production of energyOreCount
- The multiplier for the production of oreFoodCount
- The multiplier for the production of foodlandmark
- A boolean to signify if the tile is to be a landmark or notrunnable
- An object encapsulating a method that can be executed when the tile is clicked onpublic void produce()
public void setResource(java.lang.String Resource, int quantity)
Resource
- The resource that is to be changedquantity
- The amount that it is to be set to.public Player getOwner()
public void setOwner(Player Owner)
Owner
- The new owner.public int getOreCount()
public void changeOreCount(int Count)
Count
- What the count is to be changed to.public int getEnergyCount()
public void changeEnergyCount(int Count)
Count
- What the count is to be changed to.public int getFoodCount()
public void changeFoodCount(int count)
public void assignRoboticon(Roboticon roboticon)
roboticon
- The roboticon to be added to the list.public void unassignRoboticon(Roboticon Roboticon)
Roboticon
- The roboticon to be removed.public java.lang.Runnable getFunction()
public void runFunction()
public void drawTooltip()
public void drawBorder()
public int getID()
public boolean isOwned()
public void setTileBorderColor(com.badlogic.gdx.graphics.Color color)
color
- The new colour of the tile's borderpublic com.badlogic.gdx.graphics.Color tileBorderColor()
public boolean hasRoboticon()
public Roboticon getRoboticonStored()
public boolean chancellorIsVisible()
public void showchancellorTexture()
public void hidechancellorTexture()