Package tech.underoaks.coldcase.game
Class Interaction
java.lang.Object
tech.underoaks.coldcase.game.Interaction
Represents an interaction between two objects in the game world.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault 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 TypeMethodDescriptionReturns 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.Vector2Returns a copy of the target position for this interaction.getUuid()Returns the UUID of the executing GameController associated with this interaction.voidsetActionDirection(Direction actionDirection) Sets the direction for the action of this interaction.voidSets the caller for this interaction.voidsetParameters(int[] parameters) Sets the additional parameters for this interaction.voidsetTargetPos(com.badlogic.gdx.math.Vector2 targetPos) Sets the target position for this interaction.
-
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 interactionactionDirection- the direction in which the action should be performedcaller- the class representing the object that initiated the interactionparameters- 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
Vector2is mutable.- Returns:
- a
Vector2representing 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- theVector2representing the new target position
-
getActionDirection
Returns the direction of the action for this interaction.- Returns:
- the action direction as a
Directionenum value
-
setActionDirection
Sets the direction for the action of this interaction.- Parameters:
actionDirection- theDirectionto set for the action
-
getCaller
Returns the fully-qualified name of the caller that initiated this interaction.- Returns:
- the caller's class name as a
String
-
setCaller
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
Returns the UUID of the executing GameController associated with this interaction.- Returns:
- the UUID as a
String
-