Class Interaction

java.lang.Object
tech.underoaks.coldcase.game.Interaction

public class Interaction extends Object
Represents an interaction between two objects in the game world.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor.
    Interaction(com.badlogic.gdx.math.Vector2 targetPos, Direction actionDirection, Class<?> caller, int... parameters)
    Constructs an Interaction with the specified target position, action direction, caller, and additional parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the direction of the action for this interaction.
    Returns the fully-qualified name of the caller that initiated this interaction.
    int[]
    Returns the additional parameters associated with this interaction.
    com.badlogic.gdx.math.Vector2
    Returns a copy of the target position for this interaction.
    Returns the UUID of the executing GameController associated with this interaction.
    void
    setActionDirection(Direction actionDirection)
    Sets the direction for the action of this interaction.
    void
    setCaller(Class<?> caller)
    Sets the caller for this interaction.
    void
    setParameters(int[] parameters)
    Sets the additional parameters for this interaction.
    void
    setTargetPos(com.badlogic.gdx.math.Vector2 targetPos)
    Sets the target position for this interaction.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Interaction

      public Interaction()
      Default constructor. For serialization purposes.
    • Interaction

      public Interaction(com.badlogic.gdx.math.Vector2 targetPos, Direction actionDirection, Class<?> caller, int... parameters)
      Constructs an Interaction with the specified target position, action direction, caller, and additional parameters.

      The target position is copied to prevent external modifications. The caller is stored as its fully-qualified class name. The UUID is set based on the current GameController instance.

      Parameters:
      targetPos - the target position for the interaction
      actionDirection - the direction in which the action should be performed
      caller - the class representing the object that initiated the interaction
      parameters - additional parameters for the interaction
  • Method Details

    • getTargetPos

      public com.badlogic.gdx.math.Vector2 getTargetPos()
      Returns a copy of the target position for this interaction.

      A copy is returned to maintain immutability since Vector2 is mutable.

      Returns:
      a Vector2 representing the target position
    • setTargetPos

      public void setTargetPos(com.badlogic.gdx.math.Vector2 targetPos)
      Sets the target position for this interaction.

      A copy of the provided vector is used to prevent external modifications.

      Parameters:
      targetPos - the Vector2 representing the new target position
    • getActionDirection

      public Direction getActionDirection()
      Returns the direction of the action for this interaction.
      Returns:
      the action direction as a Direction enum value
    • setActionDirection

      public void setActionDirection(Direction actionDirection)
      Sets the direction for the action of this interaction.
      Parameters:
      actionDirection - the Direction to set for the action
    • getCaller

      public String getCaller()
      Returns the fully-qualified name of the caller that initiated this interaction.
      Returns:
      the caller's class name as a String
    • setCaller

      public void setCaller(Class<?> caller)
      Sets the caller for this interaction.

      The caller is recorded as the fully-qualified name of the provided class.

      Parameters:
      caller - the class representing the caller initiating the interaction
    • getParameters

      public int[] getParameters()
      Returns the additional parameters associated with this interaction.
      Returns:
      an array of integers representing the parameters
    • setParameters

      public void setParameters(int[] parameters)
      Sets the additional parameters for this interaction.
      Parameters:
      parameters - an array of integers representing the parameters
    • getUuid

      public String getUuid()
      Returns the UUID of the executing GameController associated with this interaction.
      Returns:
      the UUID as a String