update
This commit is contained in:
@@ -13343,6 +13343,7 @@ GameObject:
|
||||
- component: {fileID: 5202821522363770394}
|
||||
- component: {fileID: 1486775676321644921}
|
||||
- component: {fileID: 8796553624329906391}
|
||||
- component: {fileID: 433263687854393238}
|
||||
m_Layer: 31
|
||||
m_Name: Nolan
|
||||
m_TagString: Untagged
|
||||
@@ -15127,6 +15128,7 @@ MonoBehaviour:
|
||||
NetworkedBehaviours:
|
||||
- {fileID: 1486775676321644921}
|
||||
- {fileID: 8796553624329906391}
|
||||
- {fileID: 433263687854393238}
|
||||
ForceRemoteRenderTimeframe: 0
|
||||
--- !u!114 &1486775676321644921
|
||||
MonoBehaviour:
|
||||
@@ -15157,6 +15159,20 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 39343fbd597ed5947b34fa2777fa1b7c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::Hallucinate.Network.FusionClientMovementBridge
|
||||
--- !u!114 &433263687854393238
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 3995187695885635779}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b3d9934ebd60c9c4ea3e464b77fd7ae0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PlayerDataManager
|
||||
_Players:
|
||||
_items: []
|
||||
--- !u!1 &4047096238443104023
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -46,7 +46,8 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Assembly-CSharp::PlayerDataManager
|
||||
_Players:
|
||||
_items: []
|
||||
_items:
|
||||
- {}
|
||||
--- !u!114 &-7009574229380509654
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -36,7 +36,8 @@ namespace Hallucinate.Network
|
||||
{
|
||||
// Because we passed State Authority to the client in BasicSpawner,
|
||||
// HasStateAuthority is true ONLY for the local player.
|
||||
bool isLocal = Object.HasStateAuthority;
|
||||
// Check HasInputAuthority as well so the client's character correctly activates input!
|
||||
bool isLocal = Object.HasStateAuthority || Object.HasInputAuthority;
|
||||
|
||||
if (isLocal)
|
||||
{
|
||||
@@ -75,15 +76,29 @@ namespace Hallucinate.Network
|
||||
|
||||
public override void FixedUpdateNetwork()
|
||||
{
|
||||
if (Object.HasStateAuthority)
|
||||
// ONLY attempt to get input if we are the Host (StateAuthority) or the owning Client (InputAuthority).
|
||||
// Calling GetInput on a Proxy (someone else's character) is what causes the GetTypeKey exception!
|
||||
if (Object.HasStateAuthority || Object.HasInputAuthority)
|
||||
{
|
||||
if (GetInput<PlayerInputData>(out var input))
|
||||
{
|
||||
SyncInput = input;
|
||||
// Apply input locally so the Client's character actually moves predicted!
|
||||
if (m_CharacterLocomotion != null)
|
||||
{
|
||||
m_CharacterLocomotion.InputVector = input.InputVector;
|
||||
m_CharacterLocomotion.RawInputVector = input.RawInputVector;
|
||||
m_CharacterLocomotion.DeltaRotation = input.DeltaRotation;
|
||||
}
|
||||
|
||||
if (Object.HasStateAuthority)
|
||||
{
|
||||
SyncInput = input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Object.HasStateAuthority)
|
||||
// If we do NOT have StateAuthority AND we do NOT have InputAuthority, it's a Proxy (remote player).
|
||||
if (Object.IsProxy)
|
||||
{
|
||||
// Ensure look source is attached for remote players
|
||||
if (m_CharacterLocomotion != null && m_CharacterLocomotion.LookSource != (ILookSource)this)
|
||||
@@ -206,7 +221,7 @@ namespace Hallucinate.Network
|
||||
|
||||
// --- INetworkInfo Implementation ---
|
||||
|
||||
public bool IsLocalPlayer() => Object.HasStateAuthority;
|
||||
public bool IsLocalPlayer() => Object.HasStateAuthority || Object.HasInputAuthority;
|
||||
public bool IsServer() => Runner.IsServer;
|
||||
|
||||
// Return FALSE because we are doing Client-Authoritative movement!
|
||||
|
||||
Reference in New Issue
Block a user