Class PlayerMovement
Inheritance
Namespace: Player
Assembly: cs.temp.dll.dll
Syntax
public class PlayerMovement : MonoBehaviour
Fields
coyoteTime
Time window after leaving ground where jump is still allowed (coyote time).
Declaration
public float coyoteTime
Field Value
| Type | Description |
|---|---|
| float |
ground
Layers considered as ground for the player.
Declaration
public LayerMask ground
Field Value
| Type | Description |
|---|---|
| LayerMask |
groundCheckDistance
Distance to check below the player for ground detection.
Declaration
public float groundCheckDistance
Field Value
| Type | Description |
|---|---|
| float |
jumpLenience
Time window after pressing jump where jump is still buffered.
Declaration
public float jumpLenience
Field Value
| Type | Description |
|---|---|
| float |
jumpSpeed
Force applied when jumping.
Declaration
public float jumpSpeed
Field Value
| Type | Description |
|---|---|
| float |
maxSpeed
Maximum allowed horizontal speed for the player.
Declaration
public float maxSpeed
Field Value
| Type | Description |
|---|---|
| float |
maxSpeedOverride
Runtime override for the maximum speed.
Declaration
public float maxSpeedOverride
Field Value
| Type | Description |
|---|---|
| float |
playerText
Reference to the player's UI text displaying player index.
Declaration
public TextMeshProUGUI playerText
Field Value
| Type | Description |
|---|---|
| TextMeshProUGUI |
secondsToFullSpeed
Time in seconds to reach full speed from rest.
Declaration
public float secondsToFullSpeed
Field Value
| Type | Description |
|---|---|
| float |
slowdownMultiplier
Multiplier for slowing down the player when exceeding max speed.
Declaration
public float slowdownMultiplier
Field Value
| Type | Description |
|---|---|
| float |
timeUnableToBeDeclaredNotJumping
Minimum time before the player can be declared as not jumping.
Declaration
public float timeUnableToBeDeclaredNotJumping
Field Value
| Type | Description |
|---|---|
| float |
turnaroundMultiplier
Multiplier applied when turning around to adjust speed.
Declaration
public float turnaroundMultiplier
Field Value
| Type | Description |
|---|---|
| float |
virtualAxisX
Current value of the horizontal movement axis.
Declaration
public float virtualAxisX
Field Value
| Type | Description |
|---|---|
| float |
virtualButtonJump
Current value of the jump button (pressed or not).
Declaration
public float virtualButtonJump
Field Value
| Type | Description |
|---|---|
| float |
virtualButtonJumpLastFrame
Value of the jump button in the previous frame.
Declaration
public float virtualButtonJumpLastFrame
Field Value
| Type | Description |
|---|---|
| float |
walkSmooth
Smoothing factor for walking movement.
Declaration
public float walkSmooth
Field Value
| Type | Description |
|---|---|
| float |
walkSpeed
Base walk speed of the player.
Declaration
public float walkSpeed
Field Value
| Type | Description |
|---|---|
| float |
walkSpeedFactor
Multiplier applied to walk speed.
Declaration
public float walkSpeedFactor
Field Value
| Type | Description |
|---|---|
| float |
Methods
GetPointInBoxCollider(BoxCollider2D, float, float)
Gets a point on the BoxCollider2D based on horizontal and vertical multipliers.
Declaration
public Vector2 GetPointInBoxCollider(BoxCollider2D boxCollider2D, float horizontal, float vertical)
Parameters
| Type | Name | Description |
|---|---|---|
| BoxCollider2D | boxCollider2D | The BoxCollider2D to use. |
| float | horizontal | Horizontal offset (-1 for left, 1 for right, 0 for center). |
| float | vertical | Vertical offset (-1 for bottom, 1 for top, 0 for center). |
Returns
| Type | Description |
|---|---|
| Vector2 | The calculated point in world space. |
IsBasicallyGrounded()
Checks if the player is considered grounded, including coyote time.
Declaration
public bool IsBasicallyGrounded()
Returns
| Type | Description |
|---|---|
| bool | True if the player is basically grounded, otherwise false. |
IsPhysicallyGrounded()
Checks if the player is physically touching the ground using raycasts.
Declaration
public bool IsPhysicallyGrounded()
Returns
| Type | Description |
|---|---|
| bool | True if the player is physically grounded, otherwise false. |
StopVelocity()
Stops the player's velocity if grounded, removing inertia.
Declaration
public void StopVelocity()