몬스터 공격 시 캐릭터 방어력 값 참조 추가 및 리워드 코드 추가
This commit is contained in:
@@ -4892,7 +4892,7 @@ PrefabInstance:
|
|||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3656570700648378249, guid: f92c93d0d7d455d40b84e993e40acfca, type: 3}
|
- target: {fileID: 3656570700648378249, guid: f92c93d0d7d455d40b84e993e40acfca, type: 3}
|
||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
value: 0
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 8528093570479225059, guid: f92c93d0d7d455d40b84e993e40acfca, type: 3}
|
- target: {fileID: 8528093570479225059, guid: f92c93d0d7d455d40b84e993e40acfca, type: 3}
|
||||||
propertyPath: m_LocalPosition.x
|
propertyPath: m_LocalPosition.x
|
||||||
@@ -23595,12 +23595,12 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1536652427}
|
m_GameObject: {fileID: 1536652427}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 106.94, y: -122.39568, z: -0.84816027}
|
m_LocalPosition: {x: 106.94, y: -122.39568, z: -0.84816027}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 2141442126}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1673487154
|
--- !u!1 &1673487154
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -31192,6 +31192,63 @@ Tilemap:
|
|||||||
e31: 0
|
e31: 0
|
||||||
e32: 0
|
e32: 0
|
||||||
e33: 1
|
e33: 1
|
||||||
|
--- !u!1001 &1727802694
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 120.41427
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: -123.45756
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0.060982164
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8244087370906109303, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 8816565783318691943, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: BlueRex
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: 6aa4e890ef61e8340a0913d21ef8b769, type: 3}
|
||||||
--- !u!1 &1924016271
|
--- !u!1 &1924016271
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -33814,12 +33871,12 @@ Transform:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1974803044}
|
m_GameObject: {fileID: 1974803044}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||||
m_LocalPosition: {x: 136.07, y: -122.39568, z: -0.84816027}
|
m_LocalPosition: {x: 136.07, y: -122.39568, z: -0.84816027}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 2141442126}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1986734010
|
--- !u!1 &1986734010
|
||||||
GameObject:
|
GameObject:
|
||||||
@@ -33855,6 +33912,63 @@ Transform:
|
|||||||
- {fileID: 1271586652}
|
- {fileID: 1271586652}
|
||||||
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!1001 &2017562215
|
||||||
|
PrefabInstance:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
serializedVersion: 2
|
||||||
|
m_Modification:
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransformParent: {fileID: 0}
|
||||||
|
m_Modifications:
|
||||||
|
- target: {fileID: 5532926939721588456, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_Name
|
||||||
|
value: YellowPumpkin
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.x
|
||||||
|
value: 133.58
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.y
|
||||||
|
value: -123.54
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalPosition.z
|
||||||
|
value: 0.060982164
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.w
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalRotation.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.x
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.y
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 6350789727210486896, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
|
propertyPath: m_LocalEulerAnglesHint.z
|
||||||
|
value: 0
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
m_RemovedComponents: []
|
||||||
|
m_RemovedGameObjects: []
|
||||||
|
m_AddedGameObjects: []
|
||||||
|
m_AddedComponents: []
|
||||||
|
m_SourcePrefab: {fileID: 100100000, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
--- !u!1 &2055060999
|
--- !u!1 &2055060999
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -34106,7 +34220,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 0
|
||||||
--- !u!114 &2141442125
|
--- !u!114 &2141442125
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -34122,6 +34236,7 @@ MonoBehaviour:
|
|||||||
spawnPoints:
|
spawnPoints:
|
||||||
- {fileID: 1536652428}
|
- {fileID: 1536652428}
|
||||||
- {fileID: 1974803045}
|
- {fileID: 1974803045}
|
||||||
|
currentWave: 0
|
||||||
waveDataArray:
|
waveDataArray:
|
||||||
- monsterPrefabA: {fileID: 9096056522544909490, guid: 53f5c583c440aa546bde473536a2ead1, type: 3}
|
- monsterPrefabA: {fileID: 9096056522544909490, guid: 53f5c583c440aa546bde473536a2ead1, type: 3}
|
||||||
monsterPrefabB: {fileID: 5532926939721588456, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
monsterPrefabB: {fileID: 5532926939721588456, guid: b4cf92d97c6e476458cfc19779d644d0, type: 3}
|
||||||
@@ -34135,6 +34250,7 @@ MonoBehaviour:
|
|||||||
- monsterPrefabA: {fileID: 0}
|
- monsterPrefabA: {fileID: 0}
|
||||||
monsterPrefabB: {fileID: 0}
|
monsterPrefabB: {fileID: 0}
|
||||||
bossPrefab: {fileID: 3667660097767351871, guid: ef14281ca23119941b755a7bff7ff6c8, type: 3}
|
bossPrefab: {fileID: 3667660097767351871, guid: ef14281ca23119941b755a7bff7ff6c8, type: 3}
|
||||||
|
waveCounter: {fileID: 0}
|
||||||
--- !u!4 &2141442126
|
--- !u!4 &2141442126
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -34147,7 +34263,9 @@ Transform:
|
|||||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||||
m_ConstrainProportionsScale: 0
|
m_ConstrainProportionsScale: 0
|
||||||
m_Children: []
|
m_Children:
|
||||||
|
- {fileID: 1536652428}
|
||||||
|
- {fileID: 1974803045}
|
||||||
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!1660057539 &9223372036854775807
|
--- !u!1660057539 &9223372036854775807
|
||||||
@@ -34163,5 +34281,5 @@ SceneRoots:
|
|||||||
- {fileID: 541272685}
|
- {fileID: 541272685}
|
||||||
- {fileID: 480895542}
|
- {fileID: 480895542}
|
||||||
- {fileID: 2141442126}
|
- {fileID: 2141442126}
|
||||||
- {fileID: 1536652428}
|
- {fileID: 2017562215}
|
||||||
- {fileID: 1974803045}
|
- {fileID: 1727802694}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace TON
|
|||||||
[SerializeField] private GameObject _target; // 몬스터의 타겟
|
[SerializeField] private GameObject _target; // 몬스터의 타겟
|
||||||
[SerializeField] private Collider2D _collider; // 몬스터의 콜라이더
|
[SerializeField] private Collider2D _collider; // 몬스터의 콜라이더
|
||||||
[SerializeField] private SpriteRenderer _spriteRenderer; // 몬스터의 스프라이트 렌더러
|
[SerializeField] private SpriteRenderer _spriteRenderer; // 몬스터의 스프라이트 렌더러
|
||||||
[SerializeField] private TextMeshProUGUI _textState;
|
// [SerializeField] private TextMeshProUGUI _textState;
|
||||||
[SerializeField] public int id; // 몬스터의 ID
|
[SerializeField] public int id; // 몬스터의 ID
|
||||||
public float defencePower;
|
public float defencePower;
|
||||||
public float defenceIntention = 30; // 몬스터 방어력 변수
|
public float defenceIntention = 30; // 몬스터 방어력 변수
|
||||||
@@ -20,9 +20,11 @@ namespace TON
|
|||||||
public float currentHP { get; private set; } // 몬스터 현재 체력
|
public float currentHP { get; private set; } // 몬스터 현재 체력
|
||||||
private float hpMaxWidth;
|
private float hpMaxWidth;
|
||||||
|
|
||||||
|
private PlayerData _playerData;
|
||||||
private MonsterData _monsterData;
|
private MonsterData _monsterData;
|
||||||
private Animator _animator; // 몬스터 애니메이터
|
private Animator _animator; // 몬스터 애니메이터
|
||||||
private string currentAnimationState; // 현재 애니메이션 상태
|
private string currentAnimationState; // 현재 애니메이션 상태
|
||||||
|
private float moveSpeed = 2f;
|
||||||
|
|
||||||
StateMachine _stateMachine;
|
StateMachine _stateMachine;
|
||||||
private SkillPattern _skillPattern;
|
private SkillPattern _skillPattern;
|
||||||
@@ -33,6 +35,10 @@ namespace TON
|
|||||||
public bool IsFinishAttack { get; set; } // 몬스터 공격 모션이 끝났는지 여부
|
public bool IsFinishAttack { get; set; } // 몬스터 공격 모션이 끝났는지 여부
|
||||||
public bool IsSkillAttackable => _skillPattern.IsAttackable;
|
public bool IsSkillAttackable => _skillPattern.IsAttackable;
|
||||||
|
|
||||||
|
public int Gold = 0;
|
||||||
|
public int Exp = 0;
|
||||||
|
public int Score = 0;
|
||||||
|
|
||||||
private void Start()
|
private void Start()
|
||||||
{
|
{
|
||||||
_animator = GetComponent<Animator>(); // 애니메이터 컴포넌트 초기화
|
_animator = GetComponent<Animator>(); // 애니메이터 컴포넌트 초기화
|
||||||
@@ -45,8 +51,6 @@ namespace TON
|
|||||||
|
|
||||||
_skillPattern = new Monster1SkillPattern(_monsterData, this);
|
_skillPattern = new Monster1SkillPattern(_monsterData, this);
|
||||||
|
|
||||||
id = _monsterData.id;
|
|
||||||
|
|
||||||
_direction = new Vector3(1, 0, 0); // 초기 이동 방향 (x 축 양의 방향)
|
_direction = new Vector3(1, 0, 0); // 초기 이동 방향 (x 축 양의 방향)
|
||||||
|
|
||||||
_spriteRenderer.flipX = !(_direction.x > 0); // 이동 방향에 따라 스프라이트 플립
|
_spriteRenderer.flipX = !(_direction.x > 0); // 이동 방향에 따라 스프라이트 플립
|
||||||
@@ -62,8 +66,11 @@ namespace TON
|
|||||||
{
|
{
|
||||||
currentHP = _monsterData.hp;
|
currentHP = _monsterData.hp;
|
||||||
defencePower = _monsterData.defencePower;
|
defencePower = _monsterData.defencePower;
|
||||||
|
Gold = _monsterData.Gold;
|
||||||
|
Exp = _monsterData.Exp;
|
||||||
|
Score = _monsterData.Score;
|
||||||
|
|
||||||
Debug.Log($"몬스터 {_monsterData.name} 데이터 로드 완료");
|
// Debug.Log($"몬스터 {_monsterData.name} 데이터 로드 완료");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -71,6 +78,11 @@ namespace TON
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void RewardData()
|
||||||
|
{
|
||||||
|
StageManager.Singleton.SetRewardData(Gold, Exp, Score);
|
||||||
|
}
|
||||||
|
|
||||||
public void ChangeAnimationState(string newState)
|
public void ChangeAnimationState(string newState)
|
||||||
{
|
{
|
||||||
if (currentAnimationState == newState) return; // 현재 상태와 동일한 상태일 경우, 애니메이션을 변경하지 않음
|
if (currentAnimationState == newState) return; // 현재 상태와 동일한 상태일 경우, 애니메이션을 변경하지 않음
|
||||||
@@ -94,7 +106,7 @@ namespace TON
|
|||||||
float prevHP = currentHP; // 몬스터의 체력을 감소시키고, 죽었을 경우 파괴 처리
|
float prevHP = currentHP; // 몬스터의 체력을 감소시키고, 죽었을 경우 파괴 처리
|
||||||
currentHP -= damage;
|
currentHP -= damage;
|
||||||
|
|
||||||
UpdateHPBar();
|
UpdateHPBar(currentHP);
|
||||||
|
|
||||||
if (prevHP > 0 && currentHP <= 0)
|
if (prevHP > 0 && currentHP <= 0)
|
||||||
{
|
{
|
||||||
@@ -107,7 +119,7 @@ namespace TON
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateHPBar()
|
private void UpdateHPBar(float currentHP)
|
||||||
{
|
{
|
||||||
if (_hpBarImage != null)
|
if (_hpBarImage != null)
|
||||||
{
|
{
|
||||||
@@ -118,15 +130,14 @@ namespace TON
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Attack(GameObject player)
|
public void Attack()
|
||||||
{
|
{
|
||||||
// 데미지 계산 (현재 임시 값)
|
// 데미지 계산 (현재 임시 값)
|
||||||
DamageCalculator damageCalculator = new DamageCalculator();
|
DamageCalculator damageCalculator = new DamageCalculator();
|
||||||
|
|
||||||
float baseAttack = _monsterData.attackPower; // 기본 공격력
|
float baseAttack = _monsterData.attackPower; // 기본 공격력
|
||||||
float equipmentAttack = 0; // 장비 공격력
|
float equipmentAttack = 0; // 장비 공격력
|
||||||
// float defense = _monsterData.defencePower; // 방어력 비율
|
float defense = PlayerDataManager.Singleton.player.defensivePower / (PlayerDataManager.Singleton.player.defensivePower + PlayerDataManager.Singleton.defensiveIntention); // 캐릭터 방어력
|
||||||
float defense = PlayerDataManager.Singleton.defensiveIntention; // 캐릭터 방어력
|
|
||||||
|
|
||||||
// 기본 데미지 계산 (치명타 없음)
|
// 기본 데미지 계산 (치명타 없음)
|
||||||
float damage = damageCalculator.CalculateBaseDamage(baseAttack, equipmentAttack, defense);
|
float damage = damageCalculator.CalculateBaseDamage(baseAttack, equipmentAttack, defense);
|
||||||
@@ -134,12 +145,6 @@ namespace TON
|
|||||||
Debug.Log($" 몬스터 공격! 최종 데미지: {damage}"); // 데미지 출력
|
Debug.Log($" 몬스터 공격! 최종 데미지: {damage}"); // 데미지 출력
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayerAttack()
|
|
||||||
{
|
|
||||||
var target = GameObject.FindGameObjectWithTag("Player");
|
|
||||||
Attack(target);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetOppositionDirection()
|
public void SetOppositionDirection()
|
||||||
{
|
{
|
||||||
_direction *= -1; // 이동 방향 반전
|
_direction *= -1; // 이동 방향 반전
|
||||||
@@ -148,7 +153,7 @@ namespace TON
|
|||||||
|
|
||||||
public void Move()
|
public void Move()
|
||||||
{
|
{
|
||||||
transform.Translate(_direction * _monsterData.moveSpeed * Time.deltaTime); // 몬스터를 이동시킴
|
transform.Translate(_direction * moveSpeed * Time.deltaTime); // 몬스터를 이동시킴
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Chasing()
|
public void Chasing()
|
||||||
@@ -157,17 +162,21 @@ namespace TON
|
|||||||
UnityEngine.Vector2 direction = target.transform.position - transform.position; // 타겟과의 방향 계산
|
UnityEngine.Vector2 direction = target.transform.position - transform.position; // 타겟과의 방향 계산
|
||||||
_spriteRenderer.flipX = target.transform.position.x < transform.position.x; // 타겟이 왼쪽에 있으면 스프라이트를 왼쪽으로, 오른쪽에 있으면 오른쪽으로 바라보도록 설정
|
_spriteRenderer.flipX = target.transform.position.x < transform.position.x; // 타겟이 왼쪽에 있으면 스프라이트를 왼쪽으로, 오른쪽에 있으면 오른쪽으로 바라보도록 설정
|
||||||
|
|
||||||
transform.Translate(direction.normalized * _monsterData.moveSpeed * Time.deltaTime); // 타겟 방향으로 이동
|
transform.Translate(direction.normalized * moveSpeed * Time.deltaTime); // 타겟 방향으로 이동
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MonsterSkillLaunch()
|
public void MonsterSkillLaunch()
|
||||||
{
|
{
|
||||||
var target = GameObject.FindGameObjectWithTag("Player");
|
if (_monsterData.monsterSkillID != 0)
|
||||||
_skillPattern.Attack(target);
|
{
|
||||||
|
var target = GameObject.FindGameObjectWithTag("Player");
|
||||||
|
_skillPattern.Attack(target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DestroyMonster()
|
public void DestroyMonster()
|
||||||
{
|
{
|
||||||
|
RewardData();
|
||||||
Destroy(gameObject); // 몬스터 파괴
|
Destroy(gameObject); // 몬스터 파괴
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Assets.PixelFantasy.PixelMonsters.Common.Scripts;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@@ -8,6 +9,7 @@ namespace TON
|
|||||||
{
|
{
|
||||||
public class MonsterSpawner : MonoBehaviour
|
public class MonsterSpawner : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
private MonsterBase _monsterBase;
|
||||||
public Transform[] spawnPoints; // 스폰 위치 배열
|
public Transform[] spawnPoints; // 스폰 위치 배열
|
||||||
|
|
||||||
private List<GameObject> monsterPool; // 몬스터 오브젝트 풀
|
private List<GameObject> monsterPool; // 몬스터 오브젝트 풀
|
||||||
@@ -76,6 +78,9 @@ namespace TON
|
|||||||
private void StartNextWave()
|
private void StartNextWave()
|
||||||
{
|
{
|
||||||
currentWave++;
|
currentWave++;
|
||||||
|
|
||||||
|
StageManager.Singleton.SetWaveData(currentWave); // 웨이브 정보 전달.
|
||||||
|
|
||||||
if (currentWave > TOTAL_WAVES)
|
if (currentWave > TOTAL_WAVES)
|
||||||
{
|
{
|
||||||
// Debug.Log("모든 웨이브 완료!");
|
// Debug.Log("모든 웨이브 완료!");
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ namespace TON
|
|||||||
|
|
||||||
_monsterBase = monsterBase;
|
_monsterBase = monsterBase;
|
||||||
_monsterBase.ChangeAnimationState(AniWalk);
|
_monsterBase.ChangeAnimationState(AniWalk);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
@@ -182,7 +181,6 @@ namespace TON
|
|||||||
|
|
||||||
// 추적 상태
|
// 추적 상태
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +224,7 @@ namespace TON
|
|||||||
private void Attack()
|
private void Attack()
|
||||||
{
|
{
|
||||||
_monsterBase.ChangeAnimationState(AniAttack);
|
_monsterBase.ChangeAnimationState(AniAttack);
|
||||||
_monsterBase.PlayerAttack();
|
_monsterBase.Attack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit()
|
public void Exit()
|
||||||
|
|||||||
Reference in New Issue
Block a user