Class PortalObject

java.lang.Object
tech.underoaks.coldcase.state.tileContent.TileContent
tech.underoaks.coldcase.state.tileContent.PortalObject
All Implemented Interfaces:
Cloneable

public class PortalObject extends TileContent
The PortalObject class represents a portal within the game world that allows the player to send an item to the other player through the portal.

The player can send an item through the portal by interacting with it whilst holding an item. In this case the item gets transferred to the other portal. He can also pick up an item laying on the portal.

  • Constructor Details

    • PortalObject

      public PortalObject()
      Default-Constructor
  • Method Details

    • render

      public void render(com.badlogic.gdx.graphics.g2d.Batch batch, float x, float y)
      Description copied from class: TileContent
      Renders the tileContent at the specified coordinates using the given SpriteBatch. If the tile has no texture, this method renders nothing.

      If the tileContent has a TileContent, the render method of the content is called.

      Overrides:
      render in class TileContent
      Parameters:
      batch - the SpriteBatch used to render the tileContent
      x - the x-coordinate for rendering the tile
      y - the y-coordinate for rendering the tile
    • action

      public boolean action(InteractionChain chain, Interaction interaction) throws GameStateUpdateException
      Description copied from class: TileContent
      Performs the action associated with this TileContent when interacted with.
      Specified by:
      action in class TileContent
      Parameters:
      chain - InteractionChain managing the snapshot.
      interaction - The interaction to trigger.
      Returns:
      True if the action has been taken care of; False otherwise
      Throws:
      GameStateUpdateException - If a GameStateUpdate has failed
    • update

      public boolean update(InteractionChain chain, com.badlogic.gdx.math.Vector2 tilePosition, Interaction interaction, TileContent handler) throws GameStateUpdateException, UpdateTileContentException
      Description copied from class: TileContent
      Updates the state of this TileContent based on interactions.
      Specified by:
      update in class TileContent
      Parameters:
      chain - InteractionChain managing the snapshot.
      tilePosition - The position of the currently selected tile.
      interaction - The interaction that is currently being handled.
      handler - The TileContent that has been handling the interaction so far.
      Returns:
      True if an update has been performed; False otherwise
      Throws:
      GameStateUpdateException - If a GameStateUpdate has failed
      UpdateTileContentException - If the TileContent couldn't be updated (due to a failing validation)