quantum-space-buddies/QSB/TransformSync/PlayerTransformSync.cs
AmazingAlek 797f4de50d
Alek/anim triggers (#26)
* syncing animation triggers
* suit sync
2020-02-23 18:31:38 +01:00

42 lines
976 B
C#

using QSB.Animation;
using UnityEngine;
namespace QSB.TransformSync
{
public class PlayerTransformSync : TransformSync
{
public static PlayerTransformSync LocalInstance { get; private set; }
private Transform _playerModel;
private Transform GetPlayerModel()
{
if (!_playerModel)
{
_playerModel = Locator.GetPlayerBody().transform.Find("Traveller_HEA_Player_v2");
}
return _playerModel;
}
protected override Transform InitLocalTransform()
{
LocalInstance = this;
var body = GetPlayerModel();
GetComponent<AnimationSync>().InitLocal(body);
return body;
}
protected override Transform InitRemoteTransform()
{
var body = Instantiate(GetPlayerModel());
GetComponent<AnimationSync>().InitRemote(body);
return body;
}
}
}