diff --git a/Assets/Scripts/Core/GenericLockOnTarget.cs b/Assets/Scripts/Core/GenericLockOnTarget.cs index 161057e..6b6b0f7 100644 --- a/Assets/Scripts/Core/GenericLockOnTarget.cs +++ b/Assets/Scripts/Core/GenericLockOnTarget.cs @@ -1,16 +1,18 @@ using System; using UnityEngine; -public class GenericLockOnTarget : MonoBehaviour, ILockOnTarget{ - public float lockonTargetRadius{ get; set; } = 1f; - public bool lockonDebug{ get; set; } = false; - public float lockonRaycastVerticalOffset{ get; set; } +namespace Reset.Units{ + public class GenericLockOnTarget : MonoBehaviour, ILockOnTarget{ + public float lockonTargetRadius{ get; set; } = 1f; + public bool lockonDebug{ get; set; } = false; + public float lockonRaycastVerticalOffset{ get; set; } - public void OnTargetDelete(){ - GetComponent().SafelyDeleteTarget(); - } + public void OnTargetDelete(){ + GetComponent().SafelyDeleteTarget(); + } - void OnDestroy(){ - OnTargetDelete(); + void OnDestroy(){ + OnTargetDelete(); + } } } diff --git a/Assets/Scripts/Core/Graph Tasks/UpdateObjectCameraTracking.cs b/Assets/Scripts/Core/Graph Tasks/UpdateObjectCameraTracking.cs index d27c35e..8c91028 100644 --- a/Assets/Scripts/Core/Graph Tasks/UpdateObjectCameraTracking.cs +++ b/Assets/Scripts/Core/Graph Tasks/UpdateObjectCameraTracking.cs @@ -4,7 +4,7 @@ using ParadoxNotion.Serialization.FullSerializer; using UnityEngine; using Logger = ParadoxNotion.Services.Logger; -namespace NodeCanvas.Tasks.Actions { +namespace Reset.Units { [Category("Reset")] public class UpdateObjectCameraTracking : ActionTask { diff --git a/Assets/Scripts/Core/InputFinder.cs b/Assets/Scripts/Core/InputFinder.cs index f2d1f41..03b73cb 100644 --- a/Assets/Scripts/Core/InputFinder.cs +++ b/Assets/Scripts/Core/InputFinder.cs @@ -4,32 +4,33 @@ using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UIElements; -public class InputFinder : MonoBehaviour{ - public InputActionMap actionMap; - - void Start(){ - actionMap.actions[0].performed += ctx => { InputPressed(ctx); }; - - GetComponent().enabled = false; - } +namespace Reset.Units{ + public class InputFinder : MonoBehaviour{ + public InputActionMap actionMap; - public void AwaitNewInput(){ - GameManager.ClearCurrentController(); - - GetComponent().enabled = true; - actionMap.Enable(); - } + void Start(){ + actionMap.actions[0].performed += ctx => { InputPressed(ctx); }; - void InputPressed(InputAction.CallbackContext context){ - try { - GameManager.AttachControllerToPlayer(context.control.device); - Debug.Log(context.control.device); - } catch (Exception e) { - Debug.LogError($"Failed to set the new device to the player: {e.Message}"); - return; + GetComponent().enabled = false; } - GetComponent().enabled = false; - actionMap.Disable(); + public void AwaitNewInput(){ + PlayerManager.ClearCurrentController(); + + GetComponent().enabled = true; + actionMap.Enable(); + } + + void InputPressed(InputAction.CallbackContext context){ + try { + PlayerManager.AttachControllerToPlayer(context.control.device); + } catch (Exception e) { + Debug.LogError($"Failed to set the new device to the player: {e.Message}"); + return; + } + + GetComponent().enabled = false; + actionMap.Disable(); + } } } diff --git a/Assets/Scripts/Core/LockOnManager.cs b/Assets/Scripts/Core/LockOnManager.cs index c5208ba..8ac5582 100644 --- a/Assets/Scripts/Core/LockOnManager.cs +++ b/Assets/Scripts/Core/LockOnManager.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Numerics; using System.Runtime.CompilerServices; using Reset; +using Reset.Core; using Sirenix.OdinInspector; using Unity.Cinemachine; using UnityEngine; @@ -13,278 +14,301 @@ using UnityEngine.UIElements; using Vector2 = UnityEngine.Vector2; using Vector3 = UnityEngine.Vector3; -public class LockOnManager : MonoBehaviour{ - public class ActiveLockOnTarget{ - public GameObject gameObject; - public float targetWeight; - public float refVelocity; - public CinemachineTargetGroup.Target cinemachineTarget; - } - - public static LockOnManager Instance; - - // Lock On settings - [Space(5)] public float lockOnRange = 40f; - public float lockOnMaxAngle = 70f; - [Range(0,1)] public float mainTargetWeight = .15f; - [FormerlySerializedAs("smoothing")] public float smoothTime = 1f; - - // Lock On Tracking - [Space(10)] - - public ActiveLockOnTarget mainTarget; - - public List activeTargets = new List(); - - [ReadOnly] public CinemachineTargetGroup.Target lockonTarget; - public CinemachineTargetGroup targetGroup; - - public List acceptedTargets = new List(); - - // UI - [ShowInInspector] public UIDocument lockOnDocument; - private Label elementLabelName; - private VisualElement elementRoot; - - private void Awake(){ - // // Register as singleton - // if (Instance == null) { - // Instance = this; - // } else { - // this.enabled = false; - // return; - // } - - // References from camera - targetGroup = GameManager.Camera.transform.Find("Target Group").GetComponent(); - lockOnDocument = GameManager.UI.transform.Find("Lock On").GetComponent(); - } - - // Start is called once before the first execution of Update after the MonoBehaviour is created - void Start(){ - // Quick check for things in lock-on target that aren't lock-onable - if (mainTarget != null && mainTarget.gameObject.GetComponent() == null) { - mainTarget.gameObject.AddComponent(); - Debug.LogWarning($"The object {mainTarget.gameObject.name} has no ILockOnTarget interface. This isn't hyper critical, but adding one as a GenericLockOnTarget anyways."); +namespace Reset.Units{ + public class LockOnManager : MonoBehaviour{ + public class ActiveLockOnTarget{ + public GameObject gameObject; + public float targetWeight; + public float refVelocity; + public CinemachineTargetGroup.Target cinemachineTarget; } - elementRoot = lockOnDocument.rootVisualElement.Query("LockOnGroup"); - elementLabelName = lockOnDocument.rootVisualElement.Query