Package fr.formiko.kokcinelo.model
Class GameState
java.lang.Object
fr.formiko.kokcinelo.model.GameState
Class that containts all data about current game.
- Since:
- 0.1
- Version:
- 1.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder to use to get a GameState. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a Creature to a list of Creature where class match.Collection<com.badlogic.gdx.scenes.scene2d.Actor>
Return all the actor that GameState have.Return all Creatures.Return all MapItems.static GameState.GameStateBuilder
builder()
getAnts()
Return ants & ladybugs Removing item from this Iterable will have no impact on Collection where Creature are stored.getLevel()
int
float
float
int
int
getPlayer
(int playerId) Return player from the list of player or null if not found.getPlayerCreature
(int playerId) Return player creature or null if not found.int
getScore()
boolean
boolean
void
Try to move some AI Creature (ladybugs & Ants) away from player.void
Remove a Creature from the list of Creature where class match & from the Stage.void
remove
(Collection<Creature> creatures) Remove a collection of Creature from the list of Creature where class match & from the Stage.void
setLocalPlayerId
(int localPlayerId) void
setMaxScore
(int maxScore) void
setScore
(int score) toString()
Return most importants variables.void
updateActorVisibility
(int playerId, boolean spectatorMode) Update actor visibility so that the only visible actor are the one close enoth to the player.
-
Method Details
-
getMaxScore
public int getMaxScore() -
setMaxScore
public void setMaxScore(int maxScore) -
getScore
public int getScore() -
setScore
public void setScore(int score) -
getPercentScore
public int getPercentScore() -
getMapActorFg
-
getMapActor
-
getAphids
-
getAnts
-
getLadybugs
-
getAcidDrops
-
getBloodSpots
-
getLocalPlayerId
public int getLocalPlayerId() -
setLocalPlayerId
public void setLocalPlayerId(int localPlayerId) -
getLevel
-
getLevelId
-
getPlayer
Return player from the list of player or null if not found.- Parameters:
playerId
- id of the player- Returns:
- player that match playerId
-
getPlayerCreature
Return player creature or null if not found.- Parameters:
playerId
- id of the player- Returns:
- Creature that player embody.
-
getMapWidth
public float getMapWidth() -
getMapHeight
public float getMapHeight() -
addCreature
Add a Creature to a list of Creature where class match.- Parameters:
c
- Creature to add
-
allCreatures
Return all Creatures. Removing item from this Iterable will have no impact on Collection where Creature are stored. Use controller.toRemove.add(c) if you need to remove a creature- Returns:
- All creatures: aphids + ants + ladybugs + acid drop
-
allMapItems
Return all MapItems. -
getAntsAndLadybugs
Return ants & ladybugs Removing item from this Iterable will have no impact on Collection where Creature are stored. Use controller.toRemove.add(c) if you need to remove a creature- Returns:
- ants & ladybugs
-
allActors
Return all the actor that GameState have. It is used to add them to stage.- Returns:
- all actors to draw
-
updateActorVisibility
public void updateActorVisibility(int playerId, boolean spectatorMode) Update actor visibility so that the only visible actor are the one close enoth to the player.- Parameters:
playerId
- current player id
-
toString
Return most importants variables. -
isAllAphidGone
public boolean isAllAphidGone() -
isAllLadybugGone
public boolean isAllLadybugGone() -
remove
Remove a Creature from the list of Creature where class match & from the Stage. -
remove
Remove a collection of Creature from the list of Creature where class match & from the Stage. -
moveAIAwayFromPlayers
public void moveAIAwayFromPlayers()Try to move some AI Creature (ladybugs & Ants) away from player. It is used to give a more fair start. -
builder
-