diff --git a/Assets/Player/Input/PlayerInputs.inputactions b/Assets/Player/Input/PlayerInputs.inputactions index 3a9a34b..c40a9a0 100644 --- a/Assets/Player/Input/PlayerInputs.inputactions +++ b/Assets/Player/Input/PlayerInputs.inputactions @@ -40,6 +40,15 @@ "processors": "", "interactions": "", "initialStateCheck": false + }, + { + "name": "Lock-On", + "type": "Button", + "id": "4c8aaf72-5298-4d47-b75f-90070301913b", + "expectedControlType": "", + "processors": "", + "interactions": "", + "initialStateCheck": false } ], "bindings": [ @@ -141,6 +150,28 @@ "action": "Sprint", "isComposite": false, "isPartOfComposite": false + }, + { + "name": "", + "id": "0aec47c4-b519-4001-9408-a49abe218bd8", + "path": "", + "interactions": "", + "processors": "", + "groups": "", + "action": "Lock-On", + "isComposite": false, + "isPartOfComposite": false + }, + { + "name": "", + "id": "c9d67b81-b640-4a64-9b31-f92c927c8345", + "path": "/rightStickPress", + "interactions": "", + "processors": "", + "groups": ";Controller", + "action": "Lock-On", + "isComposite": false, + "isPartOfComposite": false } ] } diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 70b4c35..9049b29 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -2452,7 +2452,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!136 &263093400 CapsuleCollider: m_ObjectHideFlags: 0 @@ -5427,7 +5427,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!136 &1505662771 CapsuleCollider: m_ObjectHideFlags: 0 @@ -6760,6 +6760,9 @@ MonoBehaviour: m_EditorClassIdentifier: lockOnDocument: {fileID: 1223043171} lockOnTarget: {fileID: 1379573502} + targetGroup: {fileID: 615613680} + lockOnRange: 40 + lockOnTargets: [] --- !u!1 &2024357130 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Core/LockOnManager.cs b/Assets/Scripts/Core/LockOnManager.cs index 091a568..2efd4d0 100644 --- a/Assets/Scripts/Core/LockOnManager.cs +++ b/Assets/Scripts/Core/LockOnManager.cs @@ -1,11 +1,24 @@ +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{ [ShowInInspector] public UIDocument lockOnDocument; public GameObject lockOnTarget; + public CinemachineTargetGroup targetGroup; + + public float lockOnRange; + + [Space(5)] + public List lockOnTargets = new List(); private Label elementLabelName; private VisualElement elementRoot; @@ -18,9 +31,82 @@ public class LockOnManager : MonoBehaviour{ elementRoot = lockOnDocument.rootVisualElement.Query("LockOnGroup"); elementLabelName = lockOnDocument.rootVisualElement.Query