removed sprinting
This commit is contained in:
22
Player.cs
22
Player.cs
@@ -17,7 +17,6 @@ namespace Voxel
|
|||||||
|
|
||||||
private int _blockIndex = 0;
|
private int _blockIndex = 0;
|
||||||
private double _tickTime = 0;
|
private double _tickTime = 0;
|
||||||
private bool _isSprinting = false;
|
|
||||||
|
|
||||||
private Blocks _selectedBlock = Blocks.OakPlanks;
|
private Blocks _selectedBlock = Blocks.OakPlanks;
|
||||||
private Vector3 previousPosition;
|
private Vector3 previousPosition;
|
||||||
@@ -63,20 +62,11 @@ namespace Voxel
|
|||||||
if (Input.GetKey(Keys.D))
|
if (Input.GetKey(Keys.D))
|
||||||
sidewards = 1;
|
sidewards = 1;
|
||||||
|
|
||||||
_isSprinting = (Input.GetKey(Keys.LeftControl) && forwards != 0);
|
|
||||||
|
|
||||||
if (Input.GetKey(Keys.Space) && OnGround)
|
if (Input.GetKey(Keys.Space) && OnGround)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Jump");
|
Console.WriteLine("Jump");
|
||||||
Velocity = new Vector3(Velocity.X, 0.42f, Velocity.Z);
|
Velocity = new Vector3(Velocity.X, 0.42f, Velocity.Z);
|
||||||
OnGround = false;
|
OnGround = false;
|
||||||
|
|
||||||
if (_isSprinting)
|
|
||||||
{
|
|
||||||
float yawRad = MathHelper.DegreesToRadians(Rotation);
|
|
||||||
Velocity.X += 0.2f * MathF.Sin(yawRad);
|
|
||||||
Velocity.Z += 0.2f * -MathF.Cos(yawRad);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetMouseButton(MouseButton.Right) && lastClick == 0)
|
if (Input.GetMouseButton(MouseButton.Right) && lastClick == 0)
|
||||||
@@ -104,16 +94,6 @@ namespace Voxel
|
|||||||
Camera.Position = Vector3.Lerp(previousPosition, Position, alpha) + Vector3.UnitY * 0.62f;
|
Camera.Position = Vector3.Lerp(previousPosition, Position, alpha) + Vector3.UnitY * 0.62f;
|
||||||
Rotation = Camera.Yaw;
|
Rotation = Camera.Yaw;
|
||||||
|
|
||||||
if (_isSprinting)
|
|
||||||
{
|
|
||||||
Camera.TargetFOV = 70;
|
|
||||||
Camera.UpdateProjection();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Camera.TargetFOV = 60;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastClick > 0)
|
if (lastClick > 0)
|
||||||
{
|
{
|
||||||
lastClick -= deltaTime;
|
lastClick -= deltaTime;
|
||||||
@@ -142,7 +122,7 @@ namespace Voxel
|
|||||||
inputDir.X * sin + inputDir.Z * cos
|
inputDir.X * sin + inputDir.Z * cos
|
||||||
);
|
);
|
||||||
|
|
||||||
float M_t = _isSprinting ? 1.3f : 1f;
|
float M_t = 1.2f;
|
||||||
float groundMultiplier = 0.6f;
|
float groundMultiplier = 0.6f;
|
||||||
|
|
||||||
if (!OnGround)
|
if (!OnGround)
|
||||||
|
|||||||
Reference in New Issue
Block a user