Modified scene
This commit is contained in:
@@ -7,10 +7,10 @@ namespace Player
|
||||
{
|
||||
public class PlayerController : MonoBehaviour, IMovement, Input.PlayerInput.IPlayerControlActions
|
||||
{
|
||||
private const float DefaultJumpForce = 1200.0f;
|
||||
private const float DefaultJumpForce = 9.81f;
|
||||
private const float DefaultMass = 80.0f;
|
||||
private const float DefaultSpeed = 500.0f;
|
||||
private const float GravityScale = 3.0f;
|
||||
private const float GravityScale = 1.0f;
|
||||
|
||||
private Input.PlayerInput _controls;
|
||||
private Rigidbody2D _playerRigidbody2D;
|
||||
@@ -85,16 +85,12 @@ namespace Player
|
||||
|
||||
public void Move(float value)
|
||||
{
|
||||
switch (_xAxisValue)
|
||||
_playerSpriteRenderer.flipX = _xAxisValue switch
|
||||
{
|
||||
case < 0:
|
||||
_playerSpriteRenderer.flipX = true;
|
||||
break;
|
||||
case > 0:
|
||||
_playerSpriteRenderer.flipX = false;
|
||||
break;
|
||||
}
|
||||
|
||||
< 0 => true,
|
||||
> 0 => false,
|
||||
_ => _playerSpriteRenderer.flipX
|
||||
};
|
||||
_playerRigidbody2D.velocity = new Vector2(BaseSpeed * _xAxisValue * Time.fixedDeltaTime,
|
||||
_playerRigidbody2D.velocity.y);
|
||||
}
|
||||
@@ -102,7 +98,7 @@ namespace Player
|
||||
private void Jump()
|
||||
{
|
||||
_playerRigidbody2D.velocity = new Vector2(_playerRigidbody2D.velocity.x, 0);
|
||||
_playerRigidbody2D.AddForce(Vector2.up.normalized * DefaultJumpForce, ForceMode2D.Impulse);
|
||||
_playerRigidbody2D.AddForce(Vector2.up.normalized * DefaultJumpForce * DefaultMass, ForceMode2D.Impulse);
|
||||
}
|
||||
|
||||
private void Climb()
|
||||
|
Reference in New Issue
Block a user