몬스터 추격범위 추가, 플레이어 탐지 범위 리팩토링
This commit is contained in:
@@ -261,7 +261,7 @@ AnimatorStateTransition:
|
|||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
m_CanTransitionToSelf: 1
|
m_CanTransitionToSelf: 0
|
||||||
--- !u!1102 &8693684011770968853
|
--- !u!1102 &8693684011770968853
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ AnimatorState:
|
|||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_Position: {x: 50, y: 50, z: 0}
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
m_IKOnFeet: 0
|
m_IKOnFeet: 0
|
||||||
m_WriteDefaultValues: 1
|
m_WriteDefaultValues: 0
|
||||||
m_Mirror: 0
|
m_Mirror: 0
|
||||||
m_SpeedParameterActive: 0
|
m_SpeedParameterActive: 0
|
||||||
m_MirrorParameterActive: 0
|
m_MirrorParameterActive: 0
|
||||||
@@ -239,7 +239,7 @@ AnimatorStateTransition:
|
|||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
m_CanTransitionToSelf: 1
|
m_CanTransitionToSelf: 0
|
||||||
--- !u!1102 &8693684011770968853
|
--- !u!1102 &8693684011770968853
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ AnimationClip:
|
|||||||
outWeight: 0
|
outWeight: 0
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
time: 0.5
|
time: 0.5
|
||||||
value: 4.267051e-22
|
value: 3.3254636e-12
|
||||||
inSlope: Infinity
|
inSlope: Infinity
|
||||||
outSlope: Infinity
|
outSlope: Infinity
|
||||||
tangentMode: 103
|
tangentMode: 103
|
||||||
@@ -191,7 +191,7 @@ AnimationClip:
|
|||||||
outWeight: 0
|
outWeight: 0
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
time: 0.5
|
time: 0.5
|
||||||
value: 4.267051e-22
|
value: 3.3254636e-12
|
||||||
inSlope: Infinity
|
inSlope: Infinity
|
||||||
outSlope: Infinity
|
outSlope: Infinity
|
||||||
tangentMode: 103
|
tangentMode: 103
|
||||||
|
|||||||
@@ -243,4 +243,4 @@ AnimatorStateTransition:
|
|||||||
m_HasFixedDuration: 1
|
m_HasFixedDuration: 1
|
||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
m_CanTransitionToSelf: 1
|
m_CanTransitionToSelf: 0
|
||||||
|
|||||||
@@ -13507,8 +13507,9 @@ GameObject:
|
|||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 336376026}
|
- component: {fileID: 336376026}
|
||||||
- component: {fileID: 336376025}
|
- component: {fileID: 336376025}
|
||||||
|
- component: {fileID: 336376027}
|
||||||
m_Layer: 3
|
m_Layer: 3
|
||||||
m_Name: Collider
|
m_Name: Eyesight
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
@@ -13543,12 +13544,12 @@ CircleCollider2D:
|
|||||||
m_CallbackLayers:
|
m_CallbackLayers:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Bits: 4294967295
|
m_Bits: 4294967295
|
||||||
m_IsTrigger: 0
|
m_IsTrigger: 1
|
||||||
m_UsedByEffector: 0
|
m_UsedByEffector: 0
|
||||||
m_UsedByComposite: 0
|
m_UsedByComposite: 0
|
||||||
m_Offset: {x: 0, y: 0}
|
m_Offset: {x: 0, y: 0}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Radius: 0.5
|
m_Radius: 1
|
||||||
--- !u!4 &336376026
|
--- !u!4 &336376026
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -13564,6 +13565,19 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 585265470}
|
m_Father: {fileID: 585265470}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!114 &336376027
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 336376024}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0eeefb865ea9d4749bbb4de3d1100f3e, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_monsterBase: {fileID: 585265463}
|
||||||
--- !u!213 &345793892
|
--- !u!213 &345793892
|
||||||
Sprite:
|
Sprite:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -22518,6 +22532,7 @@ Transform:
|
|||||||
m_Children:
|
m_Children:
|
||||||
- {fileID: 1574532559}
|
- {fileID: 1574532559}
|
||||||
- {fileID: 336376026}
|
- {fileID: 336376026}
|
||||||
|
- {fileID: 2003670963}
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &589876486
|
--- !u!114 &589876486
|
||||||
@@ -71855,6 +71870,87 @@ Sprite:
|
|||||||
m_PhysicsShape: []
|
m_PhysicsShape: []
|
||||||
m_Bones: []
|
m_Bones: []
|
||||||
m_SpriteID:
|
m_SpriteID:
|
||||||
|
--- !u!1 &2003670962
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 2003670963}
|
||||||
|
- component: {fileID: 2003670964}
|
||||||
|
- component: {fileID: 2003670965}
|
||||||
|
m_Layer: 3
|
||||||
|
m_Name: AttackRange
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &2003670963
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2003670962}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
|
m_LocalScale: {x: 9, y: 1, z: 11}
|
||||||
|
m_ConstrainProportionsScale: 0
|
||||||
|
m_Children: []
|
||||||
|
m_Father: {fileID: 585265470}
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
|
--- !u!58 &2003670964
|
||||||
|
CircleCollider2D:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2003670962}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_Density: 1
|
||||||
|
m_Material: {fileID: 0}
|
||||||
|
m_IncludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_ExcludeLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 0
|
||||||
|
m_LayerOverridePriority: 0
|
||||||
|
m_ForceSendLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_ForceReceiveLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_ContactCaptureLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_CallbackLayers:
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Bits: 4294967295
|
||||||
|
m_IsTrigger: 1
|
||||||
|
m_UsedByEffector: 0
|
||||||
|
m_UsedByComposite: 0
|
||||||
|
m_Offset: {x: 0, y: 0}
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Radius: 0.5
|
||||||
|
--- !u!114 &2003670965
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 2003670962}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 0913d8f50c531ce4585705c1366b8351, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
_monsterBase: {fileID: 585265463}
|
||||||
--- !u!213 &2010724901
|
--- !u!213 &2010724901
|
||||||
Sprite:
|
Sprite:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
20
Gameton-06/Assets/Gameton/Scripts/Monster/Attack.cs
Normal file
20
Gameton-06/Assets/Gameton/Scripts/Monster/Attack.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TON
|
||||||
|
{
|
||||||
|
public class Attack : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private MonsterBase _monsterBase;
|
||||||
|
|
||||||
|
private void OnTriggerEnter2D(Collider2D other)
|
||||||
|
{
|
||||||
|
if (other.CompareTag("Player"))
|
||||||
|
{
|
||||||
|
_monsterBase.Attack(other.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Gameton-06/Assets/Gameton/Scripts/Monster/Attack.cs.meta
Normal file
11
Gameton-06/Assets/Gameton/Scripts/Monster/Attack.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0913d8f50c531ce4585705c1366b8351
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
50
Gameton-06/Assets/Gameton/Scripts/Monster/Eyesight.cs
Normal file
50
Gameton-06/Assets/Gameton/Scripts/Monster/Eyesight.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace TON
|
||||||
|
{
|
||||||
|
public class Eyesight : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private MonsterBase _monsterBase;
|
||||||
|
// private bool _isDetect;
|
||||||
|
|
||||||
|
|
||||||
|
private void OnTriggerEnter2D(Collider2D other)
|
||||||
|
{
|
||||||
|
if (other.CompareTag("Player"))
|
||||||
|
{
|
||||||
|
// TODO : 플레이어 감지하면 따라가기
|
||||||
|
|
||||||
|
_monsterBase.IsDetect = true;
|
||||||
|
Debug.Log("감지됨");
|
||||||
|
|
||||||
|
if (_monsterBase.IsDetect)
|
||||||
|
{
|
||||||
|
_monsterBase.Detect(other.gameObject);
|
||||||
|
|
||||||
|
// _monsterBase.IsWalking = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 단순 플레이어 태그 기준 따라가는 코드
|
||||||
|
private void FixedUpdate()
|
||||||
|
{
|
||||||
|
// 타겟의 위치에서 내 현제 위치를 뺌
|
||||||
|
// UnityEngine.Vector2 direction = target.transform.position - transform.position;
|
||||||
|
|
||||||
|
// 방향 * 속도 * 시간간격
|
||||||
|
// transform.Translate(direction.normalized * speed * Time.deltaTime);
|
||||||
|
// animator.SetBool("Iidle", true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnTriggerExit2D(Collider2D other)
|
||||||
|
{
|
||||||
|
_monsterBase.IsDetect = false;
|
||||||
|
_monsterBase.IsWalking = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Gameton-06/Assets/Gameton/Scripts/Monster/Eyesight.cs.meta
Normal file
11
Gameton-06/Assets/Gameton/Scripts/Monster/Eyesight.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0eeefb865ea9d4749bbb4de3d1100f3e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user