mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-26 18:35:34 +00:00
d762d35f56
* resetting (mostly) anim stuff when leaving * setting local instance on player transform sync right away
46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
using QSB.Animation;
|
|
using UnityEngine;
|
|
|
|
namespace QSB.TransformSync
|
|
{
|
|
public class PlayerTransformSync : TransformSync
|
|
{
|
|
public static PlayerTransformSync LocalInstance { get; private set; }
|
|
|
|
private Transform _playerModel;
|
|
|
|
public override void OnStartLocalPlayer()
|
|
{
|
|
LocalInstance = this;
|
|
}
|
|
|
|
private Transform GetPlayerModel()
|
|
{
|
|
if (!_playerModel)
|
|
{
|
|
_playerModel = Locator.GetPlayerBody().transform.Find("Traveller_HEA_Player_v2");
|
|
}
|
|
return _playerModel;
|
|
}
|
|
|
|
protected override Transform InitLocalTransform()
|
|
{
|
|
var body = GetPlayerModel();
|
|
|
|
GetComponent<AnimationSync>().InitLocal(body);
|
|
|
|
return body;
|
|
}
|
|
|
|
protected override Transform InitRemoteTransform()
|
|
{
|
|
var body = Instantiate(GetPlayerModel());
|
|
|
|
GetComponent<AnimationSync>().InitRemote(body);
|
|
|
|
return body;
|
|
}
|
|
|
|
}
|
|
}
|