CameraFacingBillboard: move to proper namespace

This commit is contained in:
JohnCorby 2022-02-11 04:39:16 -08:00
parent 4f4f630dd2
commit a0d1ab5e22

View File

@ -1,30 +1,33 @@
using UnityEngine;
public class CameraFacingBillboard : MonoBehaviour
namespace QSB.ConversationSync
{
private OWCamera _activeCam;
private void Awake()
=> GlobalMessenger<OWCamera>.AddListener("SwitchActiveCamera", OnSwitchActiveCamera);
private void Start()
public class CameraFacingBillboard : MonoBehaviour
{
_activeCam = Locator.GetActiveCamera();
UpdateRotation();
private OWCamera _activeCam;
private void Awake()
=> GlobalMessenger<OWCamera>.AddListener("SwitchActiveCamera", OnSwitchActiveCamera);
private void Start()
{
_activeCam = Locator.GetActiveCamera();
UpdateRotation();
}
private void OnDestroy()
=> GlobalMessenger<OWCamera>.RemoveListener("SwitchActiveCamera", OnSwitchActiveCamera);
private void OnSwitchActiveCamera(OWCamera activeCamera)
{
_activeCam = activeCamera;
UpdateRotation();
}
private void LateUpdate()
=> UpdateRotation();
private void UpdateRotation()
=> transform.LookAt(transform.position + (_activeCam.transform.rotation * Vector3.forward), _activeCam.transform.rotation * Vector3.up);
}
private void OnDestroy()
=> GlobalMessenger<OWCamera>.RemoveListener("SwitchActiveCamera", OnSwitchActiveCamera);
private void OnSwitchActiveCamera(OWCamera activeCamera)
{
_activeCam = activeCamera;
UpdateRotation();
}
private void LateUpdate()
=> UpdateRotation();
private void UpdateRotation()
=> transform.LookAt(transform.position + (_activeCam.transform.rotation * Vector3.forward), _activeCam.transform.rotation * Vector3.up);
}
}