Class Player


  • public final class Player
    extends Object
    Base class for player in the game, class is immutable.
    Author:
    Grégory Van den Borre
    • Field Detail

      • WORLD

        public static final Player WORLD
        World constant, to use with neutral units.
      • id

        public final be.yildizgames.common.model.PlayerId id
        Player unique id.
      • name

        public final String name
        Player unique name.
    • Method Detail

      • addAlly

        public void addAlly​(Player ally)
        Add an ally.
        Parameters:
        ally - Player to set as ally.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
        Returns:
        The hash code computed from the id.
      • equals

        public boolean equals​(Object obj)
        Overrides:
        equals in class Object
        Parameters:
        obj - Object to test for equality.
        Returns:
        true if 2 players are the same, as a player is unique, only one instance can be kept in memory.
      • toString

        public String toString()
        Overrides:
        toString in class Object
        Returns:
        The player's name.
      • see

        public boolean see​(be.yildizgames.common.model.EntityId id)
      • noLongerSee

        public boolean noLongerSee​(be.yildizgames.common.model.EntityId id)
      • isSeeing

        public boolean isSeeing​(be.yildizgames.common.model.EntityId id)