Record Class ClientState
java.lang.Object
java.lang.Record
dev.zwazel.internal.game.state.ClientState
- Record Components:
id
- The id of the clienttransformBody
- The transform of the body of the tanktransformTurret
- The transform of the turret of the tank (relative to the body)state
- The state of the player (e.g. alive, dead)shootCooldown
- The amount of ticks until the tank can shoot againcurrentHealth
- The current health of the tank
public record ClientState(long id, Transform transformBody, Transform transformTurret, ClientState.PlayerState state, long shootCooldown, float currentHealth)
extends Record
Represents the state of a client in the game.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionClientState
(long id, Transform transformBody, Transform transformTurret, ClientState.PlayerState state, long shootCooldown, float currentHealth) Creates an instance of aClientState
record class. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the value of thecurrentHealth
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.long
id()
Returns the value of theid
record component.long
Returns the value of theshootCooldown
record component.state()
Returns the value of thestate
record component.final String
toString()
Returns a string representation of this record class.Returns the value of thetransformBody
record component.Returns the value of thetransformTurret
record component.
-
Constructor Details
-
ClientState
public ClientState(long id, Transform transformBody, Transform transformTurret, ClientState.PlayerState state, long shootCooldown, float currentHealth) Creates an instance of aClientState
record class.- Parameters:
id
- the value for theid
record componenttransformBody
- the value for thetransformBody
record componenttransformTurret
- the value for thetransformTurret
record componentstate
- the value for thestate
record componentshootCooldown
- the value for theshootCooldown
record componentcurrentHealth
- the value for thecurrentHealth
record component
-
-
Method Details
-
getConnectedClientConfig
-
toString
-
hashCode
-
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
id
-
transformBody
Returns the value of thetransformBody
record component.- Returns:
- the value of the
transformBody
record component
-
transformTurret
Returns the value of thetransformTurret
record component.- Returns:
- the value of the
transformTurret
record component
-
state
-
shootCooldown
public long shootCooldown()Returns the value of theshootCooldown
record component.- Returns:
- the value of the
shootCooldown
record component
-
currentHealth
public float currentHealth()Returns the value of thecurrentHealth
record component.- Returns:
- the value of the
currentHealth
record component
-