mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Simplify Jump and reset player prefabs (#1140)
This commit is contained in:
parent
98b6328f76
commit
bcc6af8527
@ -212,8 +212,7 @@ MonoBehaviour:
|
|||||||
turnSpeedDecel: 5
|
turnSpeedDecel: 5
|
||||||
maxTurnSpeed: 150
|
maxTurnSpeed: 150
|
||||||
jumpSpeed: 0
|
jumpSpeed: 0
|
||||||
maxJumpSpeed: 5
|
jumpFactor: 0.025
|
||||||
jumpFactor: 0.05
|
|
||||||
horizontal: 0
|
horizontal: 0
|
||||||
vertical: 0
|
vertical: 0
|
||||||
turn: 0
|
turn: 0
|
||||||
@ -232,5 +231,5 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
syncMode: 0
|
syncMode: 0
|
||||||
syncInterval: 0.1
|
syncInterval: 0
|
||||||
compressRotation: 1
|
compressRotation: 1
|
||||||
|
@ -60,8 +60,7 @@ public override void OnStartLocalPlayer()
|
|||||||
|
|
||||||
[Header("Jump Settings")]
|
[Header("Jump Settings")]
|
||||||
public float jumpSpeed = 0f;
|
public float jumpSpeed = 0f;
|
||||||
public float maxJumpSpeed = 5F;
|
public float jumpFactor = .025F;
|
||||||
public float jumpFactor = .05F;
|
|
||||||
|
|
||||||
[Header("Diagnostics")]
|
[Header("Diagnostics")]
|
||||||
public float horizontal = 0f;
|
public float horizontal = 0f;
|
||||||
@ -88,8 +87,8 @@ void Update()
|
|||||||
else
|
else
|
||||||
turn = 0f;
|
turn = 0f;
|
||||||
|
|
||||||
if (!isFalling && Input.GetKey(KeyCode.Space) && (isGrounded || jumpSpeed < maxJumpSpeed))
|
if (!isFalling && Input.GetKey(KeyCode.Space) && (isGrounded || jumpSpeed < 1))
|
||||||
jumpSpeed += maxJumpSpeed * jumpFactor;
|
jumpSpeed += jumpFactor;
|
||||||
else if (isGrounded)
|
else if (isGrounded)
|
||||||
isFalling = false;
|
isFalling = false;
|
||||||
else
|
else
|
||||||
|
@ -89,8 +89,8 @@ GameObject:
|
|||||||
- component: {fileID: 33762848230157288}
|
- component: {fileID: 33762848230157288}
|
||||||
- component: {fileID: 23313067197120050}
|
- component: {fileID: 23313067197120050}
|
||||||
- component: {fileID: 143011667059871024}
|
- component: {fileID: 143011667059871024}
|
||||||
- component: {fileID: 114892629901890886}
|
|
||||||
- component: {fileID: 114402732107420660}
|
- component: {fileID: 114402732107420660}
|
||||||
|
- component: {fileID: 114892629901890886}
|
||||||
- component: {fileID: 114265392388239132}
|
- component: {fileID: 114265392388239132}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: GamePlayer
|
m_Name: GamePlayer
|
||||||
@ -177,6 +177,22 @@ CharacterController:
|
|||||||
m_SkinWidth: 0.08
|
m_SkinWidth: 0.08
|
||||||
m_MinMoveDistance: 0.001
|
m_MinMoveDistance: 0.001
|
||||||
m_Center: {x: 0, y: 0, z: 0}
|
m_Center: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &114402732107420660
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1480027675339556}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
serverOnly: 0
|
||||||
|
localPlayerAuthority: 1
|
||||||
|
m_AssetId: 21daf89214c6ee443ad6875b73083c60
|
||||||
|
m_SceneId: 0
|
||||||
--- !u!114 &114892629901890886
|
--- !u!114 &114892629901890886
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -194,34 +210,17 @@ MonoBehaviour:
|
|||||||
index: 0
|
index: 0
|
||||||
score: 0
|
score: 0
|
||||||
playerColor: {r: 0, g: 0, b: 0, a: 1}
|
playerColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
moveSpeed: 6
|
moveSpeed: 8
|
||||||
turnSpeedAccel: 5
|
turnSpeedAccel: 5
|
||||||
turnSpeedDecel: 5
|
turnSpeedDecel: 5
|
||||||
maxTurnSpeed: 150
|
maxTurnSpeed: 150
|
||||||
jumpSpeed: 0
|
jumpSpeed: 0
|
||||||
maxJumpSpeed: 5
|
jumpFactor: 0.025
|
||||||
jumpFactor: 0.05
|
|
||||||
horizontal: 0
|
horizontal: 0
|
||||||
vertical: 0
|
vertical: 0
|
||||||
turn: 0
|
turn: 0
|
||||||
isGrounded: 1
|
isGrounded: 1
|
||||||
isFalling: 0
|
isFalling: 0
|
||||||
--- !u!114 &114402732107420660
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1480027675339556}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
serverOnly: 0
|
|
||||||
localPlayerAuthority: 1
|
|
||||||
m_AssetId: 21daf89214c6ee443ad6875b73083c60
|
|
||||||
m_SceneId: 0
|
|
||||||
--- !u!114 &114265392388239132
|
--- !u!114 &114265392388239132
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -235,5 +234,5 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
syncMode: 0
|
syncMode: 0
|
||||||
syncInterval: 0.1
|
syncInterval: 0
|
||||||
compressRotation: 1
|
compressRotation: 1
|
||||||
|
@ -60,8 +60,7 @@ public override void OnStartLocalPlayer()
|
|||||||
|
|
||||||
[Header("Jump Settings")]
|
[Header("Jump Settings")]
|
||||||
public float jumpSpeed = 0f;
|
public float jumpSpeed = 0f;
|
||||||
public float maxJumpSpeed = 5F;
|
public float jumpFactor = .025F;
|
||||||
public float jumpFactor = .05F;
|
|
||||||
|
|
||||||
[Header("Diagnostics")]
|
[Header("Diagnostics")]
|
||||||
public float horizontal = 0f;
|
public float horizontal = 0f;
|
||||||
@ -88,8 +87,8 @@ void Update()
|
|||||||
else
|
else
|
||||||
turn = 0f;
|
turn = 0f;
|
||||||
|
|
||||||
if (!isFalling && Input.GetKey(KeyCode.Space) && (isGrounded || jumpSpeed < maxJumpSpeed))
|
if (!isFalling && Input.GetKey(KeyCode.Space) && (isGrounded || jumpSpeed < 1))
|
||||||
jumpSpeed += maxJumpSpeed * jumpFactor;
|
jumpSpeed += jumpFactor;
|
||||||
else if (isGrounded)
|
else if (isGrounded)
|
||||||
isFalling = false;
|
isFalling = false;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user