fix: singleton operation for LockOnManager

This commit is contained in:
Chris
2025-10-23 21:33:28 -04:00
parent 2c88685990
commit 0cb88b8fc6

View File

@@ -15,7 +15,7 @@ using Vector2 = UnityEngine.Vector2;
using Vector3 = UnityEngine.Vector3;
namespace Reset.Units{
public class LockOnManager : MonoBehaviour{
public class LockOnManager : UnitComponent, IUnitTargetProvider {
public class ActiveLockOnTarget{
public GameObject gameObject;
public float targetWeight;
@@ -47,13 +47,13 @@ namespace Reset.Units{
private VisualElement elementRoot;
private void Awake(){
// // Register as singleton
// if (Instance == null) {
// Instance = this;
// } else {
// this.enabled = false;
// return;
// }
// Register as singleton
if (Instance == null && Unit.UnitIsLocal()) {
Instance = this;
} else {
enabled = false;
return;
}
// References from camera
targetGroup = PlayerManager.Camera.transform.Find("Target Group").GetComponent<CinemachineTargetGroup>();