fix: Renamed PlayerControllerKRB to PlayerControllerRB

This commit is contained in:
MrGadget 2024-10-23 17:15:30 -04:00
parent 06f3bca80b
commit b39d7bd8d2
17 changed files with 44 additions and 44 deletions

View File

@ -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

View File

@ -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

View File

@ -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 { }
}

View File

@ -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 { }
}

View File

@ -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)
{

View File

@ -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:

View File

@ -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 { }
}

View File

@ -5,7 +5,7 @@ MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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);

View File

@ -5,7 +5,7 @@ MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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

View File

@ -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 { }
}

View File

@ -5,7 +5,7 @@ MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
icon: {fileID: 2800000, guid: 7453abfe9e8b2c04a8a47eb536fe21eb, type: 3}
userData:
assetBundleName:
assetBundleVariant: