Record Class MoveSpeed
java.lang.Object
java.lang.Record
dev.twilite.game.simulation.model.MoveSpeed
- Record Components:
stepsPerTick- number of movement steps that can be completed per game tick
Movement rate used by a simulation expansion.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMoveSpeed(double stepsPerTick) Creates an instance of aMoveSpeedrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intmaxSteps(int maxTicks) Returns how many movement steps can be considered inside a maximum tick window.doubleReturns the value of thestepsPerTickrecord component.inttickForStep(int steps) Returns the game tick when a path length has been reached.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CRAWLING
Crawling movement, one step every two ticks. -
WALKING
Walking movement, one step per tick. -
RUNNING
Running movement, two steps per tick.
-
-
Constructor Details
-
MoveSpeed
public MoveSpeed(double stepsPerTick) Creates an instance of aMoveSpeedrecord class.- Parameters:
stepsPerTick- the value for thestepsPerTickrecord component
-
-
Method Details
-
maxSteps
public int maxSteps(int maxTicks) Returns how many movement steps can be considered inside a maximum tick window.- Parameters:
maxTicks- maximum number of ticks to simulate
-
tickForStep
public int tickForStep(int steps) Returns the game tick when a path length has been reached.- Parameters:
steps- movement steps from the starting coordinate
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
stepsPerTick
public double stepsPerTick()Returns the value of thestepsPerTickrecord component.- Returns:
- the value of the
stepsPerTickrecord component
-