quantum-space-buddies/QSB/TransformSync/PlayerCameraSync.cs
Mister_Nebula 5dce7a8a03
Probe + Launcher (with associated events/transformsync changes) (#117)
* Added probe + probe launcher, with general event/transformsync/player refactors and improvements
2020-08-07 20:39:07 +01:00

42 lines
1002 B
C#

using QSB.Tools;
using UnityEngine;
namespace QSB.TransformSync
{
public class PlayerCameraSync : TransformSync
{
public static PlayerCameraSync LocalInstance { get; private set; }
public override void OnStartLocalPlayer()
{
LocalInstance = this;
}
protected override uint PlayerId => netId.Value - 2;
protected override Transform InitLocalTransform()
{
var body = Locator.GetPlayerCamera().gameObject.transform;
PlayerToolsManager.Init(body);
Player.Camera = body.gameObject;
return body;
}
protected override Transform InitRemoteTransform()
{
var body = new GameObject("PlayerCamera");
PlayerToolsManager.Init(body.transform);
Player.Camera = body;
return body.transform;
}
protected override bool IsReady => Locator.GetPlayerTransform() != null && Player != null;
}
}