Class GameState

java.lang.Object
fr.formiko.kokcinelo.model.GameState

public class GameState extends Object
Class that containts all data about current game.
Since:
0.1
Version:
1.3
  • 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

      public MapActor getMapActorFg()
    • getMapActor

      public MapActor getMapActor()
    • getAphids

      public List<Aphid> getAphids()
    • getAnts

      public List<Ant> getAnts()
    • getLadybugs

      public List<Ladybug> getLadybugs()
    • getAcidDrops

      public List<AcidDrop> getAcidDrops()
    • getBloodSpots

      public List<BloodSpot> getBloodSpots()
    • getLocalPlayerId

      public int getLocalPlayerId()
    • setLocalPlayerId

      public void setLocalPlayerId(int localPlayerId)
    • getLevel

      public Level getLevel()
    • getLevelId

      public String getLevelId()
    • getPlayer

      public Player getPlayer(int playerId)
      Return player from the list of player or null if not found.
      Parameters:
      playerId - id of the player
      Returns:
      player that match playerId
    • getPlayerCreature

      @Null public Creature getPlayerCreature(int playerId)
      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

      public void addCreature(Creature c)
      Add a Creature to a list of Creature where class match.
      Parameters:
      c - Creature to add
    • allCreatures

      public Collection<Creature> 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

      public Collection<MapItem> allMapItems()
      Return all MapItems.
    • getAntsAndLadybugs

      public Collection<Creature> 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

      public Collection<com.badlogic.gdx.scenes.scene2d.Actor> 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

      public String toString()
      Return most importants variables.
      Overrides:
      toString in class Object
      Returns:
      Most importants variables as String
    • isAllAphidGone

      public boolean isAllAphidGone()
    • isAllLadybugGone

      public boolean isAllLadybugGone()
    • remove

      public void remove(Creature c)
      Remove a Creature from the list of Creature where class match & from the Stage.
    • remove

      public void remove(Collection<Creature> creatures)
      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

      public static GameState.GameStateBuilder builder()