Package com.prineside.tdi2.systems
Class MapSystem
java.lang.Object
com.prineside.tdi2.Registrable
com.prineside.tdi2.GameSystem
com.prineside.tdi2.systems.MapSystem
- All Implemented Interfaces:
Disposable
,KryoSerializable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static final class
-
Field Summary
FieldsFields inherited from class com.prineside.tdi2.Registrable
S
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
AABB may be not present if no updates happened yet.boolean
void
despawnEnemy
(Enemy enemy) Normally not called directly - the enemy either dies or reaches its target.void
despawnUnit
(Unit unit) void
dispose()
Releases all resources of this object.void
short
getDirtyTileGeneration
(Tile tile) short
getDirtyTileGenerationAt
(int x, int y) void
getEnemiesInCircle
(float centerX, float centerY, float radiusInPixels, AABB.EntryRetriever<Enemy.EnemyReference> cb) void
getEnemiesInCircleFiltered
(float centerX, float centerY, float radiusInPixels, AABB.EntryFilter filter, AABB.EntryRetriever<Enemy.EnemyReference> cb) Note: enemy never null (if not modified during the loop)void
getEnemiesInCircleV
(Vector2 pos, float radiusInPixels, AABB.EntryRetriever<Enemy.EnemyReference> cb) void
getEnemiesInRect
(float minX, float minY, float maxX, float maxY, AABB.EntryRetriever<Enemy.EnemyReference> cb) void
getEnemiesInRectFiltered
(float minX, float minY, float maxX, float maxY, AABB.EntryFilter filter, AABB.EntryRetriever<Enemy.EnemyReference> cb) void
getMap()
int
void
getTileAndNeighbours
(int x, int y, Array<Tile> out) Получить тайл и соседей (по углам тоже)void
void
highlightGate
(Gate gate) void
highlightTile
(Tile tile) boolean
isPointWithinTile
(Tile tile, int x, int y) boolean
boolean
isVisible
(Tile tile, OrthographicCamera camera) boolean
lineCanHitEntry
(float x1, float y1, float x2, float y2) void
void
markTilesDirty
(int x, int y, int range) void
markTilesDirtyNearTile
(Tile tile, int range) void
Performs the final configuration of the system.void
boolean
Should the update() method be rendered on the debug overlayboolean
rayCastEnemies
(float startX, float startY, float endX, float endY, float rayThickness, ObjectFilter<Enemy.EnemyReference> cb) boolean
rayCastEnemiesSorted
(float startX, float startY, float endX, float endY, float rayThickness, ObjectFilter<Enemy.EnemyReference> cb) void
void
registerGate
(Gate gate) void
registerTile
(Tile tile) Напрямую внести тайл в регистр системы.void
removeBuilding
(Building building) void
void
removeMiner
(Miner miner) void
Изменить гейт во время игрыvoid
void
setMapSize
(int width, int height) void
void
setModifier
(int x, int y, Modifier modifier) void
setPathTracesDrawing
(boolean drawing) Используется в Luavoid
Изменить тайл во время игры TODO trigger an event instead and move all tower/miner/tile related logic therevoid
void
setup()
Performs the initial configuration of the system.void
showTileWarningParticle
(int x, int y) void
showTowerRangeHint
(float x, float y, float minRadius, float maxRadius) void
spawnEnemy
(Enemy enemy) Заспавнить врага на карте.void
void
traverseNeighborTilesAroundPos
(int x, int y, ObjectFilter<Tile> cb) void
traverseNeighborTilesAroundTile
(Tile tile, ObjectFilter<Tile> cb) void
traverseNeighborTilesIncludingPos
(int x, int y, ObjectFilter<Tile> cb) void
traverseNeighborTilesIncludingTile
(Tile tile, ObjectFilter<Tile> cb) void
unregisterGate
(Gate gate) void
unregisterTile
(Tile tile) Напрямую вывести тайл из регистра.void
update
(float deltaTime) void
boolean
upgradeCore
(CoreTile coreTile, int col, int row) Установить улучшение ядраvoid
upgradeCoreAction
(CoreTile coreTile, int col, int row) void
upgradeCoreActionAt
(int coreX, int coreY, int col, int row) boolean
upgradeCoreAt
(int coreX, int coreY, int col, int row) void
Methods inherited from class com.prineside.tdi2.GameSystem
getFastStateHash
Methods inherited from class com.prineside.tdi2.Registrable
isRegistered, setRegistered, setUnregistered
-
Field Details
-
TOWER_RANGE_SELECTED_COLOR
-
TOWER_RANGE_HOVER_COLOR
-
drawPathTraces
public boolean drawPathTraces -
spawnedEnemies
-
spawnedUnits
-
-
Constructor Details
-
MapSystem
public MapSystem()
-
-
Method Details
-
write
- Specified by:
write
in interfaceKryoSerializable
- Overrides:
write
in classRegistrable
-
read
- Specified by:
read
in interfaceKryoSerializable
- Overrides:
read
in classRegistrable
-
affectsGameState
public boolean affectsGameState()- Specified by:
affectsGameState
in classGameSystem
-
aabbGenerated
public boolean aabbGenerated()AABB may be not present if no updates happened yet. Usually used by the UI code which may be executed after the game is continued but no frames were simulated since.- Returns:
- true if AABB is generated and can be accessed
-
getMap
-
getTileAndNeighbours
Получить тайл и соседей (по углам тоже) -
setMap
-
setMapSize
public void setMapSize(int width, int height) -
getDirtyTileGeneration
-
getDirtyTileGenerationAt
public short getDirtyTileGenerationAt(int x, int y) -
updateDirtyTiles
public void updateDirtyTiles() -
markAllTilesDirty
public void markAllTilesDirty() -
markTilesDirtyNearTile
-
markTilesDirty
public void markTilesDirty(int x, int y, int range) - Parameters:
range
- >= 0. If 0, a single tile will be marked dirty
-
getEnemiesInRect
public void getEnemiesInRect(float minX, float minY, float maxX, float maxY, AABB.EntryRetriever<Enemy.EnemyReference> cb) - Parameters:
cb
- returns true to continue iteration and false to stop it
-
getEnemiesInRectFiltered
public void getEnemiesInRectFiltered(float minX, float minY, float maxX, float maxY, AABB.EntryFilter filter, AABB.EntryRetriever<Enemy.EnemyReference> cb) -
getEnemiesInRectV
-
getEnemiesInCircleFiltered
public void getEnemiesInCircleFiltered(float centerX, float centerY, float radiusInPixels, AABB.EntryFilter filter, AABB.EntryRetriever<Enemy.EnemyReference> cb) Note: enemy never null (if not modified during the loop) -
getEnemiesInCircle
public void getEnemiesInCircle(float centerX, float centerY, float radiusInPixels, AABB.EntryRetriever<Enemy.EnemyReference> cb) -
getEnemiesInCircleV
public void getEnemiesInCircleV(Vector2 pos, float radiusInPixels, AABB.EntryRetriever<Enemy.EnemyReference> cb) -
setup
public void setup()Description copied from class:GameSystem
Performs the initial configuration of the system. At the moment of call, systemProvider already contains all objects of systems.- Overrides:
setup
in classGameSystem
-
postStateRestore
public void postStateRestore()- Overrides:
postStateRestore
in classGameSystem
-
postSetup
public void postSetup()Description copied from class:GameSystem
Performs the final configuration of the system. At the moment of call, all systems are already loaded and setup(), all listeners are already added.- Overrides:
postSetup
in classGameSystem
-
showTileWarningParticle
public void showTileWarningParticle(int x, int y) -
removeHighlights
public void removeHighlights() -
highlightTile
-
highlightGate
-
isPointWithinTile
-
isVisible
-
setGate
Изменить гейт во время игры -
setTile
Изменить тайл во время игры TODO trigger an event instead and move all tower/miner/tile related logic there -
registerTile
Напрямую внести тайл в регистр системы. Вызывать при добавлении тайла на карту -
unregisterTile
Напрямую вывести тайл из регистра. Вызывать при удалении тайла из карты -
registerGate
-
unregisterGate
-
setTower
-
setModifier
-
removeBuilding
-
setMiner
-
removeMiner
-
isSpawned
-
spawnEnemy
Заспавнить врага на карте. Враг будет просто учитываться системой, но не получит сразу путь и позицию на карте - использовать эти данные можно только если enemy.setUpByEnemySystem -
despawnUnit
-
spawnUnit
-
despawnEnemy
Normally not called directly - the enemy either dies or reaches its target. If called directly, enemyDie / enemyReachTarget events won't be triggered -
lineCanHitEntry
public boolean lineCanHitEntry(float x1, float y1, float x2, float y2) -
rayCastEnemiesSorted
public boolean rayCastEnemiesSorted(float startX, float startY, float endX, float endY, float rayThickness, ObjectFilter<Enemy.EnemyReference> cb) -
rayCastEnemies
public boolean rayCastEnemies(float startX, float startY, float endX, float endY, float rayThickness, ObjectFilter<Enemy.EnemyReference> cb) -
getSpawnedEnemiesCountByWave
-
showTowerRangeHint
public void showTowerRangeHint(float x, float y, float minRadius, float maxRadius) -
hideTowerRangeHint
public void hideTowerRangeHint() -
upgradeCoreAction
-
upgradeCoreActionAt
public void upgradeCoreActionAt(int coreX, int coreY, int col, int row) -
upgradeCoreAt
public boolean upgradeCoreAt(int coreX, int coreY, int col, int row) -
upgradeCore
Установить улучшение ядра -
update
public void update(float deltaTime) - Overrides:
update
in classGameSystem
-
profileUpdate
public boolean profileUpdate()Description copied from class:GameSystem
Should the update() method be rendered on the debug overlay- Overrides:
profileUpdate
in classGameSystem
-
getSystemName
- Specified by:
getSystemName
in classGameSystem
-
setPathTracesDrawing
public void setPathTracesDrawing(boolean drawing) Используется в Lua -
traverseNeighborTilesAroundPos
- Parameters:
cb
- should return false to stop the loop
-
traverseNeighborTilesAroundTile
-
traverseNeighborTilesIncludingPos
- Parameters:
cb
- should return false to stop the loop
-
traverseNeighborTilesIncludingTile
-
drawBatch
-
dispose
public void dispose()Description copied from interface:com.badlogic.gdx.utils.Disposable
Releases all resources of this object.- Specified by:
dispose
in interfaceDisposable
- Overrides:
dispose
in classGameSystem
-