Character camera and movement fix - maybe 2
This commit is contained in:
@@ -261,6 +261,7 @@ namespace MegaKoop.Game.Networking
|
||||
var thirdPersonCamera = clone.GetComponentInChildren<ThirdPersonCamera>(true);
|
||||
if (thirdPersonCamera != null)
|
||||
{
|
||||
thirdPersonCamera.gameObject.SetActive(info.IsLocal);
|
||||
thirdPersonCamera.enabled = info.IsLocal;
|
||||
if (info.IsLocal)
|
||||
{
|
||||
|
||||
@@ -33,14 +33,12 @@ namespace MegaKoop.Game.Networking
|
||||
public readonly int NetworkId;
|
||||
public readonly Vector2 MoveInput;
|
||||
public readonly bool JumpPressed;
|
||||
public readonly Vector2 LookDelta;
|
||||
|
||||
public PlayerInputMessage(int networkId, Vector2 moveInput, bool jumpPressed, Vector2 lookDelta)
|
||||
public PlayerInputMessage(int networkId, Vector2 moveInput, bool jumpPressed)
|
||||
{
|
||||
NetworkId = networkId;
|
||||
MoveInput = moveInput;
|
||||
JumpPressed = jumpPressed;
|
||||
LookDelta = lookDelta;
|
||||
}
|
||||
|
||||
public static byte[] Serialize(PlayerInputMessage message)
|
||||
@@ -50,8 +48,6 @@ namespace MegaKoop.Game.Networking
|
||||
writer.Write(message.MoveInput.x);
|
||||
writer.Write(message.MoveInput.y);
|
||||
writer.Write(message.JumpPressed);
|
||||
writer.Write(message.LookDelta.x);
|
||||
writer.Write(message.LookDelta.y);
|
||||
return writer.ToArray();
|
||||
}
|
||||
|
||||
@@ -62,9 +58,7 @@ namespace MegaKoop.Game.Networking
|
||||
float moveX = reader.ReadFloat();
|
||||
float moveY = reader.ReadFloat();
|
||||
bool jump = reader.ReadBool();
|
||||
float lookX = reader.ReadFloat();
|
||||
float lookY = reader.ReadFloat();
|
||||
return new PlayerInputMessage(id, new Vector2(moveX, moveY), jump, new Vector2(lookX, lookY));
|
||||
return new PlayerInputMessage(id, new Vector2(moveX, moveY), jump);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace MegaKoop.Game.Networking
|
||||
return;
|
||||
}
|
||||
|
||||
var message = new PlayerInputMessage(identity.NetworkId, moveInput, jump, Vector2.zero);
|
||||
var message = new PlayerInputMessage(identity.NetworkId, moveInput, jump);
|
||||
byte[] payload = PlayerInputMessage.Serialize(message);
|
||||
if (!networkManager.IsConnected || networkManager.IsHost)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user