From 8d5f5894f70c870a9d47d5e655aa9c2e184119a4 Mon Sep 17 00:00:00 2001 From: Mingu Kim Date: Tue, 18 Feb 2025 15:35:05 +0900 Subject: [PATCH] =?UTF-8?q?AttackPattern=20=EB=88=84=EB=9D=BD=EB=90=9C=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Gameton/Scripts/Monster/AttackPattern.cs | 83 +++++++++++++++++++ .../Scripts/Monster/AttackPattern.cs.meta | 11 +++ .../Gameton/Scripts/Monster/MonsterBase.cs | 8 +- 3 files changed, 98 insertions(+), 4 deletions(-) create mode 100644 Gameton-06/Assets/Gameton/Scripts/Monster/AttackPattern.cs create mode 100644 Gameton-06/Assets/Gameton/Scripts/Monster/AttackPattern.cs.meta diff --git a/Gameton-06/Assets/Gameton/Scripts/Monster/AttackPattern.cs b/Gameton-06/Assets/Gameton/Scripts/Monster/AttackPattern.cs new file mode 100644 index 00000000..de291f8e --- /dev/null +++ b/Gameton-06/Assets/Gameton/Scripts/Monster/AttackPattern.cs @@ -0,0 +1,83 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace TON +{ + public class AttackPattern + { + protected MonsterBase _monsterBase; + + + public AttackPattern(MonsterBase monsterBase) + { + _monsterBase = monsterBase; + } + + public virtual void Attack() + { + } + } + + public class Monster1AttackPattern : AttackPattern + { + public Monster1AttackPattern(MonsterBase monsterBase) : base(monsterBase) + { + } + + public override void Attack() + { + + Skill1(); + + MeleeAttack(); + + } + + private void Skill1() + { + _monsterBase.MonsterSkillLaunch(); + } + + private void MeleeAttack() + { + _monsterBase.PlayerAttack(); + } + } + + public class Monster2AttackPattern : AttackPattern + { + + + public Monster2AttackPattern(MonsterBase monsterBase) : base(monsterBase) + { + + } + + public override void Attack() + { + + Skill1(); + + Skill2(); + + MeleeAttack(); + + } + + private void Skill1() + { + + } + + private void Skill2() + { + + } + + private void MeleeAttack() + { + _monsterBase.PlayerAttack(); + } + } +} diff --git a/Gameton-06/Assets/Gameton/Scripts/Monster/AttackPattern.cs.meta b/Gameton-06/Assets/Gameton/Scripts/Monster/AttackPattern.cs.meta new file mode 100644 index 00000000..d10e9f20 --- /dev/null +++ b/Gameton-06/Assets/Gameton/Scripts/Monster/AttackPattern.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 55724230a1ec9b5418a40829c72b81fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterBase.cs b/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterBase.cs index 53540869..16157c44 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterBase.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Monster/MonsterBase.cs @@ -64,10 +64,10 @@ namespace TON // 첫 번째 프레임 전에 호출됩니다. private void Start() - { - // 전략 패턴 - _attackPattern = new Monster1AttackPattern(); - _attackPattern = new Monster2AttackPattern(); + { // 전략 패턴 + // TODO : 수정중 + // _attackPattern = new Monster1AttackPattern(); + // _attackPattern = new Monster2AttackPattern(); _animator = GetComponent(); // 애니메이터 컴포넌트 초기화