diff --git a/Assets/Scripts/Units/ILockOnTarget.cs b/Assets/Scripts/Units/ILockOnTarget.cs new file mode 100644 index 0000000..21eb2b3 --- /dev/null +++ b/Assets/Scripts/Units/ILockOnTarget.cs @@ -0,0 +1,49 @@ +using UnityEngine; + +namespace Reset.Units{ + public interface ILockOnTarget{ + public float lockonTargetRadius{ set; get; } + public bool lockonDebug{ set; get; } + + public float lockonRaycastVerticalOffset{ set; get; } + + Transform transform{ get; } + GameObject gameObject{ get; } + + abstract void OnTargetDelete(); + + void Help(){ + SafelyDeleteTarget(); + } + + public Vector3 GetReticlePosition(){ + float upValue = 0f; + + if (gameObject.GetComponent()) { + Bounds objectBounds = gameObject.GetComponent().bounds; + upValue = objectBounds.size.y; + upValue = 4f; + } + + Vector3 reticlePosition = + new Vector3(transform.position.x, transform.position.y + upValue, transform.position.z); + + return reticlePosition; + } + + public void SafelyDeleteTarget(){ + // gameObject. + foreach (LockOnManager.ActiveLockOnTarget target in LockOnManager.Instance.activeTargets) { + if (target.gameObject == this.gameObject) { + GameObject clone = new GameObject + { name = $"Target Clone of {gameObject.name}", transform = { position = transform.position } }; + + target.gameObject = clone; + target.cinemachineTarget.Object = clone.transform; + + LockOnManager.Instance.QueueTargetRemoval(clone, true); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Units/ILockOnTarget.cs.meta b/Assets/Scripts/Units/ILockOnTarget.cs.meta new file mode 100644 index 0000000..e7dfdb4 --- /dev/null +++ b/Assets/Scripts/Units/ILockOnTarget.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3cf599680bc840b59ee6ea3cd0114ab8 +timeCreated: 1765311171 \ No newline at end of file diff --git a/Assets/Scripts/Units/PlayerCamera.cs b/Assets/Scripts/Units/PlayerCamera.cs index 672b927..8a294ef 100644 --- a/Assets/Scripts/Units/PlayerCamera.cs +++ b/Assets/Scripts/Units/PlayerCamera.cs @@ -1,54 +1,6 @@ using System; using UnityEngine; -namespace Reset.Units{ - public interface ILockOnTarget{ - public float lockonTargetRadius{ set; get; } - public bool lockonDebug{ set; get; } - - public float lockonRaycastVerticalOffset{ set; get; } - - Transform transform{ get; } - GameObject gameObject{ get; } - - abstract void OnTargetDelete(); - - void Help(){ - SafelyDeleteTarget(); - } - - public Vector3 GetReticlePosition(){ - float upValue = 0f; - - if (gameObject.GetComponent()) { - Bounds objectBounds = gameObject.GetComponent().bounds; - upValue = objectBounds.size.y; - upValue = 4f; - } - - Vector3 reticlePosition = - new Vector3(transform.position.x, transform.position.y + upValue, transform.position.z); - - return reticlePosition; - } - - public void SafelyDeleteTarget(){ - // gameObject. - foreach (LockOnManager.ActiveLockOnTarget target in LockOnManager.Instance.activeTargets) { - if (target.gameObject == this.gameObject) { - GameObject clone = new GameObject - { name = $"Target Clone of {gameObject.name}", transform = { position = transform.position } }; - - target.gameObject = clone; - target.cinemachineTarget.Object = clone.transform; - - LockOnManager.Instance.QueueTargetRemoval(clone, true); - } - } - } - } -} - public class PlayerCamera : MonoBehaviour{ void Start(){