This commit is contained in:
aube.lee
2025-02-27 19:23:20 +09:00
35 changed files with 205 additions and 74 deletions

View File

@@ -637,7 +637,7 @@ MonoBehaviour:
_collider: {fileID: 0} _collider: {fileID: 0}
_spriteRenderer: {fileID: 5120407950894233432} _spriteRenderer: {fileID: 5120407950894233432}
_textState: {fileID: 0} _textState: {fileID: 0}
id: 0 id: 5
defencePower: 10 defencePower: 10
defenceIntention: 30 defenceIntention: 30
_hpBarImage: {fileID: 0} _hpBarImage: {fileID: 0}

View File

@@ -556,7 +556,7 @@ MonoBehaviour:
_collider: {fileID: 898726376241471782} _collider: {fileID: 898726376241471782}
_spriteRenderer: {fileID: 4428022325186423475} _spriteRenderer: {fileID: 4428022325186423475}
_textState: {fileID: 0} _textState: {fileID: 0}
id: 0 id: 6
defencePower: 10 defencePower: 10
defenceIntention: 30 defenceIntention: 30
_hpBarImage: {fileID: 0} _hpBarImage: {fileID: 0}

View File

@@ -222,7 +222,7 @@ MonoBehaviour:
_collider: {fileID: 0} _collider: {fileID: 0}
_spriteRenderer: {fileID: 453936598381272866} _spriteRenderer: {fileID: 453936598381272866}
_textState: {fileID: 0} _textState: {fileID: 0}
id: 0 id: 3
defencePower: 10 defencePower: 10
defenceIntention: 30 defenceIntention: 30
_hpBarImage: {fileID: 0} _hpBarImage: {fileID: 0}

View File

@@ -222,7 +222,7 @@ MonoBehaviour:
_collider: {fileID: 3873838448514641420} _collider: {fileID: 3873838448514641420}
_spriteRenderer: {fileID: 1884691218758219349} _spriteRenderer: {fileID: 1884691218758219349}
_textState: {fileID: 0} _textState: {fileID: 0}
id: 0 id: 2
defencePower: 10 defencePower: 10
defenceIntention: 30 defenceIntention: 30
_hpBarImage: {fileID: 0} _hpBarImage: {fileID: 0}

View File

@@ -562,7 +562,7 @@ MonoBehaviour:
_collider: {fileID: 0} _collider: {fileID: 0}
_spriteRenderer: {fileID: 6858484445723671200} _spriteRenderer: {fileID: 6858484445723671200}
_textState: {fileID: 0} _textState: {fileID: 0}
id: 0 id: 7
defencePower: 10 defencePower: 10
defenceIntention: 30 defenceIntention: 30
_hpBarImage: {fileID: 0} _hpBarImage: {fileID: 0}

View File

@@ -221,7 +221,7 @@ MonoBehaviour:
_collider: {fileID: 0} _collider: {fileID: 0}
_spriteRenderer: {fileID: 8612529477884142844} _spriteRenderer: {fileID: 8612529477884142844}
_textState: {fileID: 0} _textState: {fileID: 0}
id: 0 id: 9
defencePower: 10 defencePower: 10
defenceIntention: 30 defenceIntention: 30
_hpBarImage: {fileID: 0} _hpBarImage: {fileID: 0}

View File

@@ -303,7 +303,7 @@ MonoBehaviour:
_collider: {fileID: 8010211321467272694} _collider: {fileID: 8010211321467272694}
_spriteRenderer: {fileID: 4483099703633942840} _spriteRenderer: {fileID: 4483099703633942840}
_textState: {fileID: 0} _textState: {fileID: 0}
id: 0 id: 4
defencePower: 10 defencePower: 10
defenceIntention: 30 defenceIntention: 30
_hpBarImage: {fileID: 0} _hpBarImage: {fileID: 0}

View File

@@ -302,7 +302,7 @@ MonoBehaviour:
_collider: {fileID: 0} _collider: {fileID: 0}
_spriteRenderer: {fileID: 7017725869417428001} _spriteRenderer: {fileID: 7017725869417428001}
_textState: {fileID: 0} _textState: {fileID: 0}
id: 0 id: 8
defencePower: 10 defencePower: 10
defenceIntention: 30 defenceIntention: 30
_hpBarImage: {fileID: 0} _hpBarImage: {fileID: 0}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a2179de65a08c654095761c249c47aab
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -378,7 +378,7 @@ MonoBehaviour:
_collider: {fileID: 7092071574192076242} _collider: {fileID: 7092071574192076242}
_spriteRenderer: {fileID: 7956262371853790530} _spriteRenderer: {fileID: 7956262371853790530}
_textState: {fileID: 0} _textState: {fileID: 0}
id: 0 id: 1
defencePower: 10 defencePower: 10
defenceIntention: 30 defenceIntention: 30
_hpBarImage: {fileID: 0} _hpBarImage: {fileID: 0}

View File

@@ -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}

View File

@@ -4961,7 +4961,7 @@ GameObject:
- component: {fileID: 480895542} - component: {fileID: 480895542}
m_Layer: 0 m_Layer: 0
m_Name: TON.Player m_Name: TON.Player
m_TagString: Untagged m_TagString: Player
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0

View File

@@ -13,27 +13,19 @@ namespace TON
public string name; public string name;
// 몬스터 레벨 // 몬스터 레벨
public int level; public int level;
// 몬스터 타입 ex : melee, ranged
public string monsterType;
// 몬스터 체력 // 몬스터 체력
public int hp; public int hp;
// 기본 공격력 // 기본 공격력
public int attackPower; public int attackPower;
// 기본 방어력 // 기본 방어력
public int defencePower; public int defencePower;
// 몬스터 스킬 ID 1 // 몬스터 스킬 ID
public int monsterSkillID; public int monsterSkillID;
// 몬스터 스킬 ID 2 // 골드
public int monsterSkillIDTwo; public int Gold;
// 패트롤 범위 // 경험치
public float patrolRange; public int Exp;
// 인식 범위 // 점수
public float detectionRange; public int Score;
// 추적 범위
public float chaseRange;
public float moveSpeed;
// 공격 범위
public float attackRange;
} }
} }

View File

@@ -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); // 몬스터 파괴
} }
} }

View File

@@ -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("모든 웨이브 완료!");

View File

@@ -24,42 +24,43 @@ namespace TON
public class Monster1SkillPattern : SkillPattern public class Monster1SkillPattern : SkillPattern
{ {
private float _skill1CoolTime; private float _skill1CoolTime;
private float _skill2CoolTime; // private float _skill2CoolTime;
private MonsterSkillData _monsterSkillData; private MonsterSkillData _monsterSkillData;
private MonsterSkillData _monsterSkillDataTwo; // private MonsterSkillData _monsterSkillDataTwo;
private MonsterSkill _skill1; private MonsterSkill _skill1;
private MonsterSkill _skill2; // private MonsterSkill _skill2;
private Vector3 _skillOffset = new Vector3(0, -0.5f, 0); // 스킬 생성 위치 조정값 private Vector3 _skillOffset = new Vector3(0, -0.5f, 0); // 스킬 생성 위치 조정값
public Monster1SkillPattern(MonsterData monsterData, MonsterBase monsterBase) : base(monsterData, monsterBase) public Monster1SkillPattern(MonsterData monsterData, MonsterBase monsterBase) : base(monsterData, monsterBase)
{ {
_monsterSkillData = MonsterSkillDataManager.Singleton.GetMonsterSkillData(_monsterData.monsterSkillID); _monsterSkillData = MonsterSkillDataManager.Singleton.GetMonsterSkillData(_monsterData.monsterSkillID);
if (_monsterData.monsterSkillIDTwo > -1) // if (_monsterData.monsterSkillIDTwo > -1)
{ // {
_monsterSkillDataTwo = MonsterSkillDataManager.Singleton.GetMonsterSkillData(_monsterData.monsterSkillIDTwo); // _monsterSkillDataTwo = MonsterSkillDataManager.Singleton.GetMonsterSkillData(_monsterData.monsterSkillIDTwo);
} // }
if (_monsterSkillData != null && _monsterSkillDataTwo != null) // if (_monsterSkillData != null && _monsterSkillDataTwo != null)
if (_monsterSkillData != null)
{ {
Debug.Log($"몬스터 {_monsterSkillData.skillName} 데이터 로드 완료"); Debug.Log($"몬스터 {_monsterSkillData.skillName} 데이터 로드 완료");
Debug.Log($"몬스터 {_monsterSkillDataTwo.skillName} 데이터 로드 완료"); // Debug.Log($"몬스터 {_monsterSkillDataTwo.skillName} 데이터 로드 완료");
// 프리팹을 연결한 코드 // 프리팹을 연결한 코드
_skill1 = Resources.Load<MonsterSkill>($"MonsterSkillPrefabs/{_monsterSkillData.skillName}"); _skill1 = Resources.Load<MonsterSkill>($"MonsterSkillPrefabs/{_monsterSkillData.skillName}");
_skill2 = Resources.Load<MonsterSkill>($"MonsterSkillPrefabs/{_monsterSkillDataTwo.skillName}"); // _skill2 = Resources.Load<MonsterSkill>($"MonsterSkillPrefabs/{_monsterSkillDataTwo.skillName}");
} }
else else
{ {
Debug.LogError($"몬스터 스킬 ID {_monsterSkillData.skillId}에 대한 데이터를 찾을 수 없습니다."); Debug.LogError($"몬스터 스킬 ID {_monsterSkillData.skillId}에 대한 데이터를 찾을 수 없습니다.");
Debug.LogError($"몬스터 스킬 ID {_monsterSkillDataTwo.skillId}에 대한 데이터를 찾을 수 없습니다."); // Debug.LogError($"몬스터 스킬 ID {_monsterSkillDataTwo.skillId}에 대한 데이터를 찾을 수 없습니다.");
} }
_skill1CoolTime = Time.realtimeSinceStartup; _skill1CoolTime = Time.realtimeSinceStartup;
_skill2CoolTime = Time.realtimeSinceStartup; // _skill2CoolTime = Time.realtimeSinceStartup;
} }
@@ -84,11 +85,11 @@ namespace TON
IsAttackable = true; IsAttackable = true;
} }
if (Time.realtimeSinceStartup - _skill2CoolTime >= _monsterSkillDataTwo.cooldown) // if (Time.realtimeSinceStartup - _skill2CoolTime >= _monsterSkillDataTwo.cooldown)
{ // {
// TODO : 범위 체크 // // TODO : 범위 체크
IsAttackable = true; // IsAttackable = true;
} // }
} }
} }

View File

@@ -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()