Commit 6aba62ef authored by 15박보승's avatar 15박보승

타겟 록 시스템/UI 구현

parent abe8e81c
fileFormatVersion: 2
guid: dc9de6dbf24f4d64d9001cd1ffd10c7e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &5037612186728958095
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2300334253849746669}
- component: {fileID: 9045883234152086801}
- component: {fileID: 3401774927144550074}
m_Layer: 5
m_Name: TargetLocked
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2300334253849746669
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5037612186728958095}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 5, y: 5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &9045883234152086801
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5037612186728958095}
m_CullTransparentMesh: 0
--- !u!114 &3401774927144550074
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5037612186728958095}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 0}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
fileFormatVersion: 2
guid: 04d7a8bd5b7afea418585e2d9e55c109
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -773,8 +773,9 @@ GameObject:
- component: {fileID: 413298775}
- component: {fileID: 413298774}
- component: {fileID: 413298773}
- component: {fileID: 413298777}
m_Layer: 5
m_Name: Canvas
m_Name: IngameUI
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
......@@ -860,6 +861,20 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &413298777
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 413298772}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4cc2b3e3c3660784ebe3d702a305b952, type: 3}
m_Name:
m_EditorClassIdentifier:
targetLockedUIPrefab: {fileID: 5037612186728958095, guid: 04d7a8bd5b7afea418585e2d9e55c109,
type: 3}
--- !u!1 &519663054
GameObject:
m_ObjectHideFlags: 0
......@@ -1169,6 +1184,99 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 126
m_CollisionDetection: 0
--- !u!1 &850429685
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 850429689}
- component: {fileID: 850429688}
- component: {fileID: 850429687}
- component: {fileID: 850429686}
m_Layer: 10
m_Name: Cylinder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!136 &850429686
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 850429685}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5000001
m_Height: 2
m_Direction: 1
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!23 &850429687
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 850429685}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &850429688
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 850429685}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &850429689
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 850429685}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.01939517, y: -4.39812, z: 15.06}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 17
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &887314838
GameObject:
m_ObjectHideFlags: 0
......@@ -1558,6 +1666,9 @@ MonoBehaviour:
groundMask:
serializedVersion: 2
m_Bits: 1
enemyMask:
serializedVersion: 2
m_Bits: 1024
--- !u!136 &1171556390
CapsuleCollider:
m_ObjectHideFlags: 0
......@@ -1572,6 +1683,99 @@ CapsuleCollider:
m_Height: 2
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &1219641831
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1219641835}
- component: {fileID: 1219641834}
- component: {fileID: 1219641833}
- component: {fileID: 1219641832}
m_Layer: 10
m_Name: Cylinder (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!136 &1219641832
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1219641831}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5000001
m_Height: 2
m_Direction: 1
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!23 &1219641833
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1219641831}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &1219641834
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1219641831}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1219641835
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1219641831}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.01939517, y: -1.48, z: 15.06}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 18
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1353089528
GameObject:
m_ObjectHideFlags: 0
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: d71b4c543a96dc645a771f6d62a28989
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class IngameUIManager : SingletonBehaviour<IngameUIManager>
{
[SerializeField]
private GameObject targetLockedUIPrefab;
private List<Image> targetLockedUIs = new List<Image>();
public void UpdateTargetLockedUIs(Vector3[] pos)
{
int tmp, i = 0;
int count = targetLockedUIs.Count;
for (int j = 0; j < pos.Length - count; j++)
{
targetLockedUIs.Add(Instantiate(targetLockedUIPrefab, transform).GetComponent<Image>());
}
//Debug.Log(targetLockedUIs.Count);
//Debug.Log(pos.Length);
for (; i < pos.Length; i++)
{
Vector2 viewportPoint = Camera.main.WorldToViewportPoint(pos[i]);
targetLockedUIs[i].rectTransform.anchorMin = viewportPoint;
targetLockedUIs[i].rectTransform.anchorMax = viewportPoint;
}
for (tmp = i; i < targetLockedUIs.Count; i++)
{
Destroy(targetLockedUIs[i].gameObject);
}
if (tmp < targetLockedUIs.Count)
{
targetLockedUIs.RemoveRange(tmp, targetLockedUIs.Count - tmp);
}
}
}
fileFormatVersion: 2
guid: 4cc2b3e3c3660784ebe3d702a305b952
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -31,6 +31,9 @@ public class PlayerController : MonoBehaviour
}
}
[SerializeField]
private LayerMask enemyMask;
#if UNITY_EDITOR
private void OnDrawGizmos()
{
......@@ -58,6 +61,25 @@ public class PlayerController : MonoBehaviour
float vertical = Input.GetAxis("Vertical");
float horizontal = Input.GetAxis("Horizontal");
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit[] enemyHits = Physics.SphereCastAll(ray, 3, 50, enemyMask);
Vector3[] positions = new Vector3[enemyHits.Length];
for(int i = 0; i < enemyHits.Length; i++)
{
positions[i] = enemyHits[i].collider.transform.position;
}
IngameUIManager.inst.UpdateTargetLockedUIs(positions);
if (Input.GetMouseButton(0))
{
foreach (var enemyHit in enemyHits)
{
Debug.Log(enemyHit.collider.gameObject);
}
}
if (Input.GetMouseButtonDown(1))
{
if (!hook.gameObject.activeSelf)
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SingletonBehaviour<T> : MonoBehaviour where T : MonoBehaviour
{
private static T _inst = null;
public static T inst
{
get
{
if (_inst == null)
{
if (FindObjectsOfType<T>().Length > 1)
Debug.LogError("More than one");
else if (FindObjectOfType<T>() != null)
_inst = FindObjectOfType<T>();
else
{
GameObject go = new GameObject
{
name = typeof(T).Name
};
_inst = go.AddComponent<T>();
}
}
return _inst;
}
}
public void SetStatic()
{
if (_inst != null)
DontDestroyOnLoad(_inst.gameObject);
}
}
fileFormatVersion: 2
guid: 872f001e951931f40bcdd24fe1ca47e8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -15,7 +15,7 @@ TagManager:
-
- Player
- PlayerPassable
-
- Enemy
-
-
-
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment