public class FogOfWar extends FeatureModel implements MapTileRenderer
Usage example:
Constructor and Description |
---|
FogOfWar()
Create a fog of war.
|
Modifier and Type | Method and Description |
---|---|
void |
create(MapTile map,
Media config)
Create a fog of war from a map.
|
boolean |
hasFogOfWar()
Check if fog of war is enabled.
|
boolean |
isFogged(int tx,
int ty)
In case of active fog of war, check if tile is hidden by fog.
|
boolean |
isFogged(Tiled tiled)
Check if the tile is currently hidden by the fog of war.
|
boolean |
isVisited(int tx,
int ty)
In case of active fog of war, check if tile has been discovered.
|
void |
renderTile(Graphic g,
MapTile map,
Tile tile,
int x,
int y)
Render tile on its designed location.
|
void |
setEnabled(boolean hide,
boolean fog)
Set fog of war enabled state.
|
void |
setTilesheet(SpriteTiled hide,
SpriteTiled fog)
Set fog tilesheet reference.
|
void |
update(Collection<Fovable> fovables)
Update fovable field of view (fog of war).
|
checkListener, getFeature, getFeatures, getFeaturesType, hasFeature, prepare
public void create(MapTile map, Media config)
map
- The map reference.config
- The fog configuration.public void update(Collection<Fovable> fovables)
fovables
- The entities reference.public void setTilesheet(SpriteTiled hide, SpriteTiled fog)
hide
- The hide tilesheet.fog
- The fog tilesheet.public void setEnabled(boolean hide, boolean fog)
hide
- true
to enable map hiding, false
else.fog
- true
to enable fog map, false
else.public boolean hasFogOfWar()
true
if fog of war is enabled, false
else.public boolean isFogged(Tiled tiled)
tiled
- The tiled to check.true
if hidden, false
else.public boolean isVisited(int tx, int ty)
tx
- The horizontal tile.ty
- The vertical tile.true
if already discovered, false
else.public boolean isFogged(int tx, int ty)
tx
- The horizontal tile.ty
- The vertical tile.true
if hidden by fog, false
else.public void renderTile(Graphic g, MapTile map, Tile tile, int x, int y)
MapTileRenderer
renderTile
in interface MapTileRenderer
g
- The graphic output.map
- The map used.tile
- The tile to render.x
- The location x.y
- The location y.Copyright © 2017 Byron 3D Games Studio. All rights reserved.