Merge branch 'dev' of https://github.com/2aurore/Gameton-06 into dev
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -11,9 +11,13 @@ namespace TON
|
|||||||
public class MonsterBase : MonoBehaviour, IDamage
|
public class MonsterBase : MonoBehaviour, IDamage
|
||||||
{
|
{
|
||||||
public int id; // 적 고유 ID
|
public int id; // 적 고유 ID
|
||||||
public int hp; // HP
|
public float currentHP = 100; // HP
|
||||||
public int damage; // 공격력
|
|
||||||
|
public string name; // 몬스터 명 or 프리팹 명
|
||||||
|
public string monsterType; // 몬스터 타입 ex : melee, ranged
|
||||||
|
|
||||||
|
|
||||||
|
// public int damage; // 공격력
|
||||||
public float speed = 2; // 이동속도
|
public float speed = 2; // 이동속도
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
@@ -22,6 +26,8 @@ namespace TON
|
|||||||
|
|
||||||
private Vector3 _direction;
|
private Vector3 _direction;
|
||||||
private bool _isWalking;
|
private bool _isWalking;
|
||||||
|
private bool _isHit;
|
||||||
|
private bool _isDetect;
|
||||||
private float _currentTime;
|
private float _currentTime;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
@@ -32,6 +38,9 @@ namespace TON
|
|||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private GameObject _target;
|
private GameObject _target;
|
||||||
|
|
||||||
|
[SerializeField]
|
||||||
|
private Collider2D _collider;
|
||||||
|
|
||||||
public float defencePower;
|
public float defencePower;
|
||||||
|
|
||||||
@@ -45,8 +54,9 @@ namespace TON
|
|||||||
_direction = new Vector3(1, 0, 0);
|
_direction = new Vector3(1, 0, 0);
|
||||||
|
|
||||||
_spriteRenderer.flipX = !(_direction.x > 0);
|
_spriteRenderer.flipX = !(_direction.x > 0);
|
||||||
|
_collider = GetComponent<Collider2D>();
|
||||||
// TODO: 몬스터 방어력 세팅 임시값
|
|
||||||
|
// TODO: 몬스터 방어력 임시값
|
||||||
defencePower = 10f;
|
defencePower = 10f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +66,8 @@ namespace TON
|
|||||||
// todo : 타겟 감지 >> 몬스터의 원형 시야 안에 플레이어가 충돌했는지 여부
|
// todo : 타겟 감지 >> 몬스터의 원형 시야 안에 플레이어가 충돌했는지 여부
|
||||||
// todo : 충돌 했으면 attack 전환 (바로 그냥 공격하게 따라가지 말고)
|
// todo : 충돌 했으면 attack 전환 (바로 그냥 공격하게 따라가지 말고)
|
||||||
// todo : 시야를 벗어났으면 idle 전환
|
// todo : 시야를 벗어났으면 idle 전환
|
||||||
|
|
||||||
|
_isDetect = false;
|
||||||
|
|
||||||
if (_isWalking)
|
if (_isWalking)
|
||||||
{
|
{
|
||||||
@@ -86,6 +97,14 @@ namespace TON
|
|||||||
_isWalking = true;
|
_isWalking = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (_isHit)
|
||||||
|
// {
|
||||||
|
// _animator.SetBool("Attack", _isDetect);
|
||||||
|
//
|
||||||
|
// _isWalking = false;
|
||||||
|
//
|
||||||
|
// }
|
||||||
_animator.SetBool("Walk", _isWalking); // 걷기 애니메이션
|
_animator.SetBool("Walk", _isWalking); // 걷기 애니메이션
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,13 +122,26 @@ namespace TON
|
|||||||
|
|
||||||
public void ApplyDamage(float damage)
|
public void ApplyDamage(float damage)
|
||||||
{
|
{
|
||||||
// TODO: 몬스터 피해 값 코드
|
// 몬스터 피해 값 코드
|
||||||
// 체력이 감소되는 부분
|
// 체력이 감소되는 부분
|
||||||
// 몬스터 죽고 파괴되는 부분
|
// 몬스터 죽고 파괴되는 부분
|
||||||
// 피격됐을때 애니메이션
|
// 피격됐을때 애니메이션
|
||||||
|
|
||||||
|
float prevHP = currentHP;
|
||||||
|
currentHP -= damage;
|
||||||
|
|
||||||
|
if (prevHP > 0 && currentHP <= 0)
|
||||||
|
{
|
||||||
|
_animator.SetBool("Die", true); // 몬스터 죽는 애니메이션 트리거
|
||||||
|
Destroy(gameObject); // 몬스터 파괴
|
||||||
|
}
|
||||||
|
else if (prevHP > 0 && currentHP > 0)
|
||||||
|
{
|
||||||
|
_animator.SetBool("Hit", true); // 피격 애니메이션
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonsterAttack()
|
void MonsterAttack(GameObject player)
|
||||||
{
|
{
|
||||||
// 임시 반영 수정 예정
|
// 임시 반영 수정 예정
|
||||||
DamageCalculator damageCalculator = new DamageCalculator();
|
DamageCalculator damageCalculator = new DamageCalculator();
|
||||||
@@ -123,5 +155,23 @@ namespace TON
|
|||||||
|
|
||||||
Debug.Log($" 몬스터 공격! 최종 데미지: {damage}");
|
Debug.Log($" 몬스터 공격! 최종 데미지: {damage}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnCollisionEnter2D(Collision2D other)
|
||||||
|
{
|
||||||
|
_isDetect = true;
|
||||||
|
|
||||||
|
if (other.collider.CompareTag("Player"))
|
||||||
|
{
|
||||||
|
|
||||||
|
_animator.SetBool("Attack", true); // 공격 애니메이션 재생
|
||||||
|
MonsterAttack(other.gameObject); // 플레이어에게 공격
|
||||||
|
Debug.Log("감지됨");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!other.collider.CompareTag("Player"))
|
||||||
|
{
|
||||||
|
_isDetect = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,6 +191,28 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
Continuous: 0
|
Continuous: 0
|
||||||
Active: 0
|
Active: 0
|
||||||
|
--- !u!1101 &-2848854086711600340
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions: []
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 3188460960225426455}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.75
|
||||||
|
m_HasExitTime: 0
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
--- !u!1102 &-1793952159812074963
|
--- !u!1102 &-1793952159812074963
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
@@ -561,6 +583,28 @@ AnimatorStateMachine:
|
|||||||
m_ExitPosition: {x: 20, y: 220, z: 0}
|
m_ExitPosition: {x: 20, y: 220, z: 0}
|
||||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
m_DefaultState: {fileID: -1674859921881163369}
|
m_DefaultState: {fileID: -1674859921881163369}
|
||||||
|
--- !u!1101 &3032347272367370037
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions: []
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: -56690746207215259}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.39999998
|
||||||
|
m_HasExitTime: 1
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
--- !u!1102 &3188460960225426455
|
--- !u!1102 &3188460960225426455
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
@@ -571,7 +615,9 @@ AnimatorState:
|
|||||||
m_Name: Attack
|
m_Name: Attack
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions: []
|
m_Transitions:
|
||||||
|
- {fileID: 4658846137002246010}
|
||||||
|
- {fileID: 3032347272367370037}
|
||||||
m_StateMachineBehaviours:
|
m_StateMachineBehaviours:
|
||||||
- {fileID: 4517560952412984766}
|
- {fileID: 4517560952412984766}
|
||||||
m_Position: {x: 50, y: 50, z: 0}
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
@@ -624,19 +670,19 @@ AnimatorStateMachine:
|
|||||||
m_ChildStates:
|
m_ChildStates:
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: 6342953676309033787}
|
m_State: {fileID: 6342953676309033787}
|
||||||
m_Position: {x: 500, y: 60, z: 0}
|
m_Position: {x: 330, y: 130, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: -56690746207215259}
|
m_State: {fileID: -56690746207215259}
|
||||||
m_Position: {x: 500, y: 160, z: 0}
|
m_Position: {x: 630, y: 130, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: 4602458092277031176}
|
m_State: {fileID: 4602458092277031176}
|
||||||
m_Position: {x: 760, y: 190, z: 0}
|
m_Position: {x: 1070, y: 280, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: -4838633882212068965}
|
m_State: {fileID: -4838633882212068965}
|
||||||
m_Position: {x: 760, y: 110, z: 0}
|
m_Position: {x: 1060, y: 350, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: 3188460960225426455}
|
m_State: {fileID: 3188460960225426455}
|
||||||
m_Position: {x: 760, y: 240, z: 0}
|
m_Position: {x: 490, y: 240, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: -136569306282141652}
|
m_State: {fileID: -136569306282141652}
|
||||||
m_Position: {x: 760, y: 290, z: 0}
|
m_Position: {x: 760, y: 290, z: 0}
|
||||||
@@ -644,13 +690,14 @@ AnimatorStateMachine:
|
|||||||
m_State: {fileID: -7991831788900291451}
|
m_State: {fileID: -7991831788900291451}
|
||||||
m_Position: {x: 760, y: 340, z: 0}
|
m_Position: {x: 760, y: 340, z: 0}
|
||||||
m_ChildStateMachines: []
|
m_ChildStateMachines: []
|
||||||
m_AnyStateTransitions: []
|
m_AnyStateTransitions:
|
||||||
|
- {fileID: -2848854086711600340}
|
||||||
m_EntryTransitions: []
|
m_EntryTransitions: []
|
||||||
m_StateMachineTransitions: {}
|
m_StateMachineTransitions: {}
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_AnyStatePosition: {x: 20, y: 180, z: 0}
|
m_AnyStatePosition: {x: 210, y: 250, z: 0}
|
||||||
m_EntryPosition: {x: 20, y: 140, z: 0}
|
m_EntryPosition: {x: 20, y: 140, z: 0}
|
||||||
m_ExitPosition: {x: 20, y: 220, z: 0}
|
m_ExitPosition: {x: 1000, y: 130, z: 0}
|
||||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
m_DefaultState: {fileID: 6342953676309033787}
|
m_DefaultState: {fileID: 6342953676309033787}
|
||||||
--- !u!114 &4102650195156319639
|
--- !u!114 &4102650195156319639
|
||||||
@@ -707,6 +754,28 @@ AnimatorState:
|
|||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
m_CycleOffsetParameter:
|
m_CycleOffsetParameter:
|
||||||
m_TimeParameter:
|
m_TimeParameter:
|
||||||
|
--- !u!1101 &4658846137002246010
|
||||||
|
AnimatorStateTransition:
|
||||||
|
m_ObjectHideFlags: 1
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_Name:
|
||||||
|
m_Conditions: []
|
||||||
|
m_DstStateMachine: {fileID: 0}
|
||||||
|
m_DstState: {fileID: 6342953676309033787}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.39999998
|
||||||
|
m_HasExitTime: 1
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
--- !u!1102 &6342953676309033787
|
--- !u!1102 &6342953676309033787
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"com.unity.cinemachine": "2.10.3",
|
"com.unity.cinemachine": "2.10.3",
|
||||||
"com.unity.collab-proxy": "2.6.0",
|
"com.unity.collab-proxy": "2.6.0",
|
||||||
"com.unity.feature.development": "1.0.1",
|
"com.unity.feature.development": "1.0.1",
|
||||||
|
"com.unity.ide.rider": "3.0.34",
|
||||||
"com.unity.textmeshpro": "3.0.6",
|
"com.unity.textmeshpro": "3.0.6",
|
||||||
"com.unity.timeline": "1.7.6",
|
"com.unity.timeline": "1.7.6",
|
||||||
"com.unity.ugui": "1.0.0",
|
"com.unity.ugui": "1.0.0",
|
||||||
|
|||||||
@@ -135,7 +135,7 @@
|
|||||||
},
|
},
|
||||||
"com.unity.ext.nunit": {
|
"com.unity.ext.nunit": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"depth": 2,
|
"depth": 1,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {},
|
"dependencies": {},
|
||||||
"url": "https://packages.unity.com"
|
"url": "https://packages.unity.com"
|
||||||
@@ -155,8 +155,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"com.unity.ide.rider": {
|
"com.unity.ide.rider": {
|
||||||
"version": "3.0.28",
|
"version": "3.0.34",
|
||||||
"depth": 1,
|
"depth": 0,
|
||||||
"source": "registry",
|
"source": "registry",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.ext.nunit": "1.0.6"
|
"com.unity.ext.nunit": "1.0.6"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user