using System; using System.Collections; using System.Collections.Generic; using System.Numerics; using Sirenix.OdinInspector; using Unity.Cinemachine; using UnityEngine; using UnityEngine.UIElements; using Vector2 = UnityEngine.Vector2; using Vector3 = UnityEngine.Vector3; public class LockOnManager : MonoBehaviour{ private CinemachineTargetGroup.Target playerTarget; // Lock On settings [Space(5)] public float lockOnRange = 40f; public float lockOnMaxAngle = 70f; // Lock On Tracking [Space(10)] public GameObject lockonGameObject; // Needed because nulling the Target below doesn't actually empty it out [ReadOnly] public CinemachineTargetGroup.Target lockonTarget; public CinemachineTargetGroup targetGroup; [Space(5)] public List lockOnTargets = new List(); // UI [ShowInInspector] public UIDocument lockOnDocument; private Label elementLabelName; private VisualElement elementRoot; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start(){ // Save the player target object to track later playerTarget = targetGroup.Targets[0]; // Quick check for things in lock-on target that aren't lock-onable if (lockonGameObject != null && lockonTarget.Object.GetComponent() == null) { Debug.LogError($"Game Object {lockonTarget.Object.name} does not implement the ILockOnTarget interface!"); } elementRoot = lockOnDocument.rootVisualElement.Query("LockOnGroup"); elementLabelName = lockOnDocument.rootVisualElement.Query