Commit 95e4b1b9 authored by 15박보승's avatar 15박보승

적과 캐릭터 사이에 장애물이 있다면 타게팅이 되지 않도록 수정

parent f88983d5
fileFormatVersion: 2
guid: 69aef0102c5caac4fb4391e08505dca0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -1445,7 +1445,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d71b4c543a96dc645a771f6d62a28989, type: 3}
m_Name:
m_EditorClassIdentifier:
maxHealth: 50
maxHealth: 500
curHealth: 0
bloodEffect: {fileID: 1345154483}
--- !u!54 &850429691
......@@ -1702,6 +1702,98 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1077217536
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1077217540}
- component: {fileID: 1077217539}
- component: {fileID: 1077217538}
- component: {fileID: 1077217537}
m_Layer: 0
m_Name: Cube (9)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!65 &1077217537
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1077217536}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1077217538
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1077217536}
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 &1077217539
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1077217536}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &1077217540
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1077217536}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.19087136, y: 0.73, z: 13.512303}
m_LocalScale: {x: 13.47, y: 20.01, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 19
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1171556382
GameObject:
m_ObjectHideFlags: 0
......@@ -1854,10 +1946,14 @@ MonoBehaviour:
groundMask:
serializedVersion: 2
m_Bits: 1
bulletMaxDistance: 0
bulletEffect: {fileID: 1266258516}
enemyMask:
serializedVersion: 2
m_Bits: 1024
bulletBlockMask:
serializedVersion: 2
m_Bits: 55
--- !u!136 &1171556390
CapsuleCollider:
m_ObjectHideFlags: 0
......@@ -1980,7 +2076,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: d71b4c543a96dc645a771f6d62a28989, type: 3}
m_Name:
m_EditorClassIdentifier:
maxHealth: 50
maxHealth: 500
curHealth: 0
bloodEffect: {fileID: 1443389647}
--- !u!54 &1219641837
......
......@@ -36,7 +36,6 @@ public class HookBehaviour : MonoBehaviour
private void FixedUpdate()
{
Debug.Log(curDistance);
if (curDistance <= maxDistance)
{
curDistance += rb.velocity.magnitude * Time.fixedDeltaTime;
......
......@@ -31,11 +31,14 @@ public class PlayerController : MonoBehaviour
}
}
[SerializeField]
private float bulletMaxDistance;
[SerializeField]
private ParticleSystem bulletEffect;
[SerializeField]
private LayerMask enemyMask;
[SerializeField]
private LayerMask bulletBlockMask;
#if UNITY_EDITOR
private void OnDrawGizmos()
......@@ -64,25 +67,32 @@ public class PlayerController : MonoBehaviour
float vertical = Input.GetAxis("Vertical");
float horizontal = Input.GetAxis("Horizontal");
RaycastHit[] enemyHits = Physics.SphereCastAll(Camera.main.ScreenPointToRay(Input.mousePosition), 3, bulletMaxDistance, enemyMask);
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;
}
List<Enemy> hitEnemies = new List<Enemy>();
List<Vector3> hitEnemyPositions = new List<Vector3>();
foreach (var enemyHit in enemyHits)
{
Ray ray = new Ray(Camera.main.transform.position, (enemyHit.point - Camera.main.transform.position).normalized);
if (!Physics.Raycast(ray, Vector3.Distance(Camera.main.transform.position, enemyHit.point), bulletBlockMask))
{
hitEnemies.Add(enemyHit.collider.GetComponent<Enemy>());
hitEnemyPositions.Add(enemyHit.transform.position);
}
}
IngameUIManager.inst.UpdateTargetLockedUIs(positions);
IngameUIManager.inst.UpdateTargetLockedUIs(hitEnemyPositions.ToArray());
if (Input.GetMouseButton(0))
{
bulletEffect.transform.rotation = Camera.main.transform.rotation;
bulletEffect.Play();
foreach (var enemyHit in enemyHits)
foreach (var enemy in hitEnemies)
{
enemyHit.collider.GetComponent<Enemy>()?.GetDamaged(1);
enemy?.GetDamaged(1);
}
}
......
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