2020-02-21 23:36:07 +01:00
|
|
|
|
using QSB.Animation;
|
|
|
|
|
using UnityEngine;
|
2020-02-10 23:03:28 +01:00
|
|
|
|
|
2020-02-21 23:36:07 +01:00
|
|
|
|
namespace QSB.TransformSync
|
2020-02-15 20:48:02 +01:00
|
|
|
|
{
|
2020-02-21 23:36:07 +01:00
|
|
|
|
public class PlayerTransformSync : TransformSync
|
2020-02-15 20:48:02 +01:00
|
|
|
|
{
|
2020-02-21 23:36:07 +01:00
|
|
|
|
public static PlayerTransformSync LocalInstance { get; private set; }
|
2020-02-10 23:03:28 +01:00
|
|
|
|
|
2020-02-21 21:51:58 +01:00
|
|
|
|
private Transform _playerModel;
|
2020-02-15 20:48:02 +01:00
|
|
|
|
|
2020-02-21 21:51:58 +01:00
|
|
|
|
private Transform GetPlayerModel()
|
2020-02-15 20:48:02 +01:00
|
|
|
|
{
|
2020-02-21 21:51:58 +01:00
|
|
|
|
if (!_playerModel)
|
2020-02-15 20:48:02 +01:00
|
|
|
|
{
|
2020-02-21 21:51:58 +01:00
|
|
|
|
_playerModel = Locator.GetPlayerBody().transform.Find("Traveller_HEA_Player_v2");
|
2020-02-15 20:48:02 +01:00
|
|
|
|
}
|
2020-02-21 21:51:58 +01:00
|
|
|
|
return _playerModel;
|
2020-02-11 19:56:57 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-21 21:51:58 +01:00
|
|
|
|
protected override Transform InitLocalTransform()
|
2020-02-15 20:48:02 +01:00
|
|
|
|
{
|
2020-02-21 21:51:58 +01:00
|
|
|
|
LocalInstance = this;
|
|
|
|
|
var body = GetPlayerModel();
|
2020-02-14 22:14:24 +01:00
|
|
|
|
|
2020-02-23 18:31:38 +01:00
|
|
|
|
GetComponent<AnimationSync>().InitLocal(body);
|
2020-02-21 21:51:58 +01:00
|
|
|
|
|
|
|
|
|
return body;
|
2020-02-12 20:05:08 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-21 21:51:58 +01:00
|
|
|
|
protected override Transform InitRemoteTransform()
|
2020-02-15 20:48:02 +01:00
|
|
|
|
{
|
2020-02-21 21:51:58 +01:00
|
|
|
|
var body = Instantiate(GetPlayerModel());
|
2020-02-12 22:00:17 +01:00
|
|
|
|
|
2020-02-23 18:31:38 +01:00
|
|
|
|
GetComponent<AnimationSync>().InitRemote(body);
|
2020-02-14 22:14:24 +01:00
|
|
|
|
|
2020-02-21 21:51:58 +01:00
|
|
|
|
return body;
|
2020-02-10 23:03:28 +01:00
|
|
|
|
}
|
2020-02-23 18:31:38 +01:00
|
|
|
|
|
2020-02-10 23:03:28 +01:00
|
|
|
|
}
|
|
|
|
|
}
|