mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 20:52:10 +01:00
Alles alter
This commit is contained in:
@@ -13,6 +13,7 @@ public class PlayerController : NetworkBehaviour
|
||||
[SerializeField] private float walkSpeed = 6.0f;
|
||||
[SerializeField] private float sprintSpeed = 10.0f;
|
||||
[SerializeField] private float aimWalkSpeed = 3.0f;
|
||||
[SerializeField] private float fallDamageSpeed = 10.0f;
|
||||
|
||||
[SerializeField][Range(0.0f, 0.5f)] private float moveSmoothTime = 0.001f;
|
||||
[SerializeField] float gravity = -10.0f;
|
||||
@@ -96,7 +97,11 @@ public class PlayerController : NetworkBehaviour
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawRay(new Ray(transform.position, moveDirection * 50));
|
||||
}
|
||||
|
||||
[Command]
|
||||
void CmdFallDamage(int damage)
|
||||
{
|
||||
GetComponent<Player>().RemoveHealth(damage);
|
||||
}
|
||||
private void UpdateMovement()
|
||||
{
|
||||
|
||||
@@ -115,6 +120,13 @@ public class PlayerController : NetworkBehaviour
|
||||
|
||||
}
|
||||
|
||||
if(isGrounded && velocity.y < -fallDamageSpeed)
|
||||
{
|
||||
Debug.Log(velocity.y);
|
||||
Debug.Log("Fall Damage");
|
||||
CmdFallDamage((int)Mathf.Abs(velocity.y));
|
||||
}
|
||||
|
||||
//Grounded
|
||||
if (velocityY < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user