Class Tile

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Tile.TileType
      Encodes all Tile variants.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      CubeCoordinate coord
      Coordinate of this tile.
      float reclaimTime
      Time left to reclaim (pick up again) a Tile.
    • Field Detail

      • coord

        public CubeCoordinate coord
        Coordinate of this tile. This may be null if tile is not placed.
      • reclaimTime

        public float reclaimTime
        Time left to reclaim (pick up again) a Tile. NaN if a tile is not pickup able.
    • Method Detail

      • clone

        public abstract Tile clone()
        Creates a clone of the tile.
        Overrides:
        clone in class java.lang.Object
        Returns:
        the new tile
      • getCoordinate

        public CubeCoordinate getCoordinate()
        Returns Coordinate of Tile.
        Returns:
        coordinate of the tile
      • reclaimable

        public boolean reclaimable()
        Returns whether a tile can be taken again. This will cost a small amount of resources.
        Returns:
        if tile is reclaimable
      • takeable

        public boolean takeable()
        Returns whether a tile can be taken again. This will cost a small amount of resources.
        Returns:
        if tile is takeable
      • serializeData

        public org.json.JSONObject serializeData()
        Serializes extra Data of an Tile, to be send.
        Returns:
        null or JSONObject with at least a valid "type" field.
      • getName

        public abstract java.lang.String getName()
        Name of Tile in Api interface.
        Returns:
        api name of the tile
      • getTileType

        public Tile.TileType getTileType()
        Return TileType of the current tile.
        Returns:
        RileType of this tile
      • deserialize

        public static Tile deserialize​(org.json.JSONObject json)
        Deserializes a Tile with data. Takes a JSONObject as argument and tries to parse it. Returns null on error.
        Parameters:
        json - json data
        Returns:
        Event or null on error.
      • deserialize

        public static Tile deserialize​(java.lang.String json)
        Deserializes a Tile without data. Takes a String as argument and tries to parse it. Returns null on error.
        Parameters:
        json - json data
        Returns:
        Event or null on error.
      • serialize

        public org.json.JSONObject serialize()
        serializes a tile to a json object.
        Returns:
        json data
      • dataToString

        public java.lang.String dataToString()
        Can be used by tile to add internal data to `toString`. Returned string should start with: ", "
        Returns:
        additional data stringified
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object