diff --git a/Assets/Mirror/Examples/PlayerTest/PlayerKRBReliable.prefab b/Assets/Mirror/Examples/PlayerTest/PlayerRBReliable.prefab similarity index 99% rename from Assets/Mirror/Examples/PlayerTest/PlayerKRBReliable.prefab rename to Assets/Mirror/Examples/PlayerTest/PlayerRBReliable.prefab index e33c42945..09496f063 100644 --- a/Assets/Mirror/Examples/PlayerTest/PlayerKRBReliable.prefab +++ b/Assets/Mirror/Examples/PlayerTest/PlayerRBReliable.prefab @@ -176,7 +176,7 @@ GameObject: - component: {fileID: 4932227711505240966} - component: {fileID: 8229469515647906458} m_Layer: 0 - m_Name: PlayerKRBReliable + m_Name: PlayerRBReliable m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Mirror/Examples/PlayerTest/PlayerKRBReliable.prefab.meta b/Assets/Mirror/Examples/PlayerTest/PlayerRBReliable.prefab.meta similarity index 100% rename from Assets/Mirror/Examples/PlayerTest/PlayerKRBReliable.prefab.meta rename to Assets/Mirror/Examples/PlayerTest/PlayerRBReliable.prefab.meta diff --git a/Assets/Mirror/Examples/PlayerTest/PlayerKRBUnreliable.prefab b/Assets/Mirror/Examples/PlayerTest/PlayerRBUnreliable.prefab similarity index 99% rename from Assets/Mirror/Examples/PlayerTest/PlayerKRBUnreliable.prefab rename to Assets/Mirror/Examples/PlayerTest/PlayerRBUnreliable.prefab index 0acbbe615..33c21577f 100644 --- a/Assets/Mirror/Examples/PlayerTest/PlayerKRBUnreliable.prefab +++ b/Assets/Mirror/Examples/PlayerTest/PlayerRBUnreliable.prefab @@ -176,7 +176,7 @@ GameObject: - component: {fileID: 1100861297868964075} - component: {fileID: 3894195534993113074} m_Layer: 0 - m_Name: PlayerKRBUnreliable + m_Name: PlayerRBUnreliable m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Mirror/Examples/PlayerTest/PlayerKRBUnreliable.prefab.meta b/Assets/Mirror/Examples/PlayerTest/PlayerRBUnreliable.prefab.meta similarity index 100% rename from Assets/Mirror/Examples/PlayerTest/PlayerKRBUnreliable.prefab.meta rename to Assets/Mirror/Examples/PlayerTest/PlayerRBUnreliable.prefab.meta diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBReliable.cs b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBReliable.cs deleted file mode 100644 index bb8849907..000000000 --- a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBReliable.cs +++ /dev/null @@ -1,8 +0,0 @@ -using UnityEngine; - -namespace Mirror.Examples.Common.Controllers.Player -{ - [AddComponentMenu("Network/Player Controller KRB (Reliable)")] - [RequireComponent(typeof(NetworkTransformReliable))] - public class PlayerControllerKRBReliable : PlayerControllerKRBBase { } -} diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUnreliable.cs b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUnreliable.cs deleted file mode 100644 index 89e941f26..000000000 --- a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUnreliable.cs +++ /dev/null @@ -1,8 +0,0 @@ -using UnityEngine; - -namespace Mirror.Examples.Common.Controllers.Player -{ - [AddComponentMenu("Network/Player Controller KRB (Unreliable)")] - [RequireComponent(typeof(NetworkTransformUnreliable))] - public class PlayerControllerKRBUnreliable : PlayerControllerKRBBase { } -} diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB.meta b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB.meta similarity index 100% rename from Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB.meta rename to Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB.meta diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBBase.cs b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBBase.cs similarity index 99% rename from Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBBase.cs rename to Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBBase.cs index c23acdaeb..e95a4d3eb 100644 --- a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBBase.cs +++ b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBBase.cs @@ -9,7 +9,7 @@ namespace Mirror.Examples.Common.Controllers.Player [RequireComponent(typeof(CapsuleCollider))] [RequireComponent(typeof(NetworkIdentity))] [DisallowMultipleComponent] - public class PlayerControllerKRBBase : NetworkBehaviour + public class PlayerControllerRBBase : NetworkBehaviour { const float BASE_DPI = 96f; @@ -290,7 +290,7 @@ public override void OnStartLocalPlayer() if (runtimeData.controllerUI != null) { - if (runtimeData.controllerUI.TryGetComponent(out PlayerControllerKRBUI canvasControlPanel)) + if (runtimeData.controllerUI.TryGetComponent(out PlayerControllerRBUI canvasControlPanel)) canvasControlPanel.Refresh(moveKeys, optionsKeys); runtimeData.controllerUI.SetActive(controlOptions.HasFlag(ControlOptions.ShowUI)); @@ -322,6 +322,22 @@ void Update() HandleMove(deltaTime); } + void FixedUpdate() + { + float fixedDeltaTime = Time.fixedDeltaTime; + ApplyMove(fixedDeltaTime); + + // Update ground state + bool isGrounded = Physics.Raycast(transform.position, Vector3.down, capsuleCollider.height / 2 + 0.1f); + if (isGrounded) + runtimeData.groundState = GroundState.Grounded; + else if (runtimeData.groundState != GroundState.Jumping) + runtimeData.groundState = GroundState.Falling; + + // Update velocity for diagnostics + runtimeData.velocity = Vector3Int.FloorToInt(rigidBody.velocity); + } + void HandleOptions() { if (optionsKeys.MouseSteer != KeyCode.None && Input.GetKeyUp(optionsKeys.MouseSteer)) @@ -348,22 +364,6 @@ void SetCursor(bool locked) Cursor.visible = !locked; } - void FixedUpdate() - { - float fixedDeltaTime = Time.fixedDeltaTime; - ApplyMove(fixedDeltaTime); - - // Update ground state - bool isGrounded = Physics.Raycast(transform.position, Vector3.down, capsuleCollider.height / 2 + 0.1f); - if (isGrounded) - runtimeData.groundState = GroundState.Grounded; - else if (runtimeData.groundState != GroundState.Jumping) - runtimeData.groundState = GroundState.Falling; - - // Update velocity for diagnostics - runtimeData.velocity = Vector3Int.FloorToInt(rigidBody.velocity); - } - // Turning works while airborne...feature? void HandleTurning(float deltaTime) { diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBBase.cs.meta b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBBase.cs.meta similarity index 61% rename from Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBBase.cs.meta rename to Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBBase.cs.meta index d28c6beeb..588277ab4 100644 --- a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBBase.cs.meta +++ b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBBase.cs.meta @@ -1,11 +1,11 @@ fileFormatVersion: 2 -guid: f49d76ebe6adef649872e344e495b1c1 +guid: 0d6d426b831ca7c43a7ebc82d324dbb6 MonoImporter: externalObjects: {} serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBReliable.cs b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBReliable.cs new file mode 100644 index 000000000..fd02d2d0b --- /dev/null +++ b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBReliable.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +namespace Mirror.Examples.Common.Controllers.Player +{ + [AddComponentMenu("Network/Player Controller RB (Reliable)")] + [RequireComponent(typeof(NetworkTransformReliable))] + public class PlayerControllerRBReliable : PlayerControllerRBBase { } +} diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBReliable.cs.meta b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBReliable.cs.meta similarity index 74% rename from Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBReliable.cs.meta rename to Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBReliable.cs.meta index c98cc5a3d..631593308 100644 --- a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBReliable.cs.meta +++ b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBReliable.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.cs b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.cs similarity index 90% rename from Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.cs rename to Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.cs index 501279bca..523f4af46 100644 --- a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.cs +++ b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.cs @@ -6,7 +6,7 @@ namespace Mirror.Examples.Common.Controllers.Player { [AddComponentMenu("")] [DisallowMultipleComponent] - public class PlayerControllerKRBUI : ContollerUIBase + public class PlayerControllerRBUI : ContollerUIBase { [Serializable] public struct MoveTexts @@ -31,7 +31,7 @@ public struct OptionsTexts [SerializeField] MoveTexts moveTexts; [SerializeField] OptionsTexts optionsTexts; - public void Refresh(PlayerControllerKRBBase.MoveKeys moveKeys, PlayerControllerKRBBase.OptionsKeys optionsKeys) + public void Refresh(PlayerControllerRBBase.MoveKeys moveKeys, PlayerControllerRBBase.OptionsKeys optionsKeys) { // Movement Keys moveTexts.keyTextTurnLeft.text = GetKeyText(moveKeys.TurnLeft); diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.cs.meta b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.cs.meta similarity index 74% rename from Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.cs.meta rename to Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.cs.meta index 4f48b516d..c1e75242e 100644 --- a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.cs.meta +++ b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.prefab b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.prefab similarity index 99% rename from Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.prefab rename to Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.prefab index b0057161e..aea100f06 100644 --- a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.prefab +++ b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.prefab @@ -143,7 +143,7 @@ GameObject: - component: {fileID: 28027543193692803} - component: {fileID: 5839359391402956113} m_Layer: 5 - m_Name: PlayerControllerKRBUI + m_Name: PlayerControllerRBUI m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.prefab.meta b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.prefab.meta similarity index 100% rename from Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUI.prefab.meta rename to Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUI.prefab.meta diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUnreliable.cs b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUnreliable.cs new file mode 100644 index 000000000..2971103dd --- /dev/null +++ b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUnreliable.cs @@ -0,0 +1,8 @@ +using UnityEngine; + +namespace Mirror.Examples.Common.Controllers.Player +{ + [AddComponentMenu("Network/Player Controller RB (Unreliable)")] + [RequireComponent(typeof(NetworkTransformUnreliable))] + public class PlayerControllerRBUnreliable : PlayerControllerRBBase { } +} diff --git a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUnreliable.cs.meta b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUnreliable.cs.meta similarity index 74% rename from Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUnreliable.cs.meta rename to Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUnreliable.cs.meta index 053bd1bbf..6e059c49e 100644 --- a/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerKRB/PlayerControllerKRBUnreliable.cs.meta +++ b/Assets/Mirror/Examples/_Common/Controllers/PlayerControllerRB/PlayerControllerRBUnreliable.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3} userData: assetBundleName: assetBundleVariant: