Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit 7bd5551

Browse files
committed
슬프게도 배틀 관련을 끝내지 못햇스빈다.
1 parent 05e8958 commit 7bd5551

29 files changed

+633
-191
lines changed

MaybeBossRaid/Jemmun/Assets/01_Script/Charactor/Archer/ArcherSkill.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ sealed protected override void Awake()
2121

2222
if (charactor.isRemote) return;
2323

24-
SetButton(0, SkillA);
25-
SetButton(1, SkillB);
24+
SetButton(0, "속사", SkillA);
25+
SetButton(1, "강사", SkillB);
2626

2727
}
2828

MaybeBossRaid/Jemmun/Assets/01_Script/Handler/BattleStartHandler.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ private void FixedUpdate()
1515
{
1616
if (signaled)
1717
{
18+
signaled = false;
1819
UnityEngine.SceneManagement.SceneManager.LoadScene("Battle");
1920
}
2021
}

MaybeBossRaid/Jemmun/Assets/01_Script/Handler/GameStartHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ private void FixedUpdate()
1616
if (bStarted)
1717
{
1818
bStarted = false;
19-
UnityEngine.SceneManagement.SceneManager.LoadScene("Battle");
19+
UnityEngine.SceneManagement.SceneManager.LoadScene("BattlePrepare");
2020
}
2121
}
2222
}

MaybeBossRaid/Jemmun/Assets/01_Script/Manager/TurnManager.cs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
public class TurnManager : MonoBehaviour
66
{
7+
[SerializeField] private Transform trmTurnIndicator = null;
8+
79
// Singleton?
810
public static TurnManager instance;
911

@@ -19,17 +21,21 @@ public class TurnManager : MonoBehaviour
1921

2022
private void Awake()
2123
{
24+
NullChecker.CheckNULL(trmTurnIndicator, true);
25+
2226
// 사실 체크를 하나 해 줘야 하는데 귀찮았스빈다.
2327
instance = this;
2428

25-
SocketClient.Send(JsonUtility.ToJson(new DataVO("gamestart", "null")));
26-
2729
turn = 0;
2830
}
2931

3032
private void Start()
3133
{
34+
SocketClient.Send(JsonUtility.ToJson(new DataVO("gamestart", "")));
35+
3236
playerList = UserManager.GetAllPlayerBase();
37+
SetTurnStatus(); // 처음에 설정해줘야죠...
38+
SetTurnIndicatorLocation();
3339
}
3440

3541

@@ -59,6 +65,8 @@ public void AddMidTask(TurnTask task)
5965
public void EndTurn()
6066
{
6167
++turn;
68+
SetTurnStatus();
69+
SetTurnIndicatorLocation();
6270
DoTurnEndTasks();
6371
}
6472

@@ -98,6 +106,23 @@ private void DoMidTurnTasks()
98106
// 캐릭터들의 턴 상태를 설정함
99107
private void SetTurnStatus()
100108
{
101-
// 턴
109+
for (int i = 0; i < playerList.Count; ++i)
110+
{
111+
playerList[i].isTurn = false;
112+
}
113+
114+
playerList[playerList.Count == 0 ? 0 : turn % playerList.Count].isTurn = true;
115+
}
116+
117+
118+
119+
// 턴 인디케이터 움직임
120+
private void SetTurnIndicatorLocation()
121+
{
122+
Vector2 targetPos = playerList[turn % playerList.Count].gameObject.transform.position;
123+
targetPos.y += 2.5f;
124+
125+
trmTurnIndicator.position = targetPos;
102126
}
127+
103128
}

MaybeBossRaid/Jemmun/Assets/01_Script/Manager/UserManager.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ public partial class UserManager : MonoBehaviour
1919
private void Awake()
2020
{
2121
instance = this;
22-
}
23-
24-
private void Start()
25-
{
2622
InitData();
2723
}
2824

@@ -49,9 +45,20 @@ private void InitData()
4945
/// <param name="vo">PlayerDataVO</param>
5046
static public void InitPlayerData(PlayerDataVO vo)
5147
{
52-
instance.players[instance.playerIndex].hp = vo.hp;
53-
instance.players[instance.playerIndex].mp = vo.mp;
54-
instance.players[instance.playerIndex].id = vo.id;
48+
int targetIdx = -1;
49+
50+
for (int i = 0; i < instance.players.Count; ++i)
51+
{
52+
if (instance.players[i].job == vo.job)
53+
{
54+
targetIdx = i;
55+
break;
56+
}
57+
}
58+
59+
instance.players[targetIdx].hp = vo.hp;
60+
instance.players[targetIdx].mp = vo.mp;
61+
instance.players[targetIdx].id = vo.id;
5562
}
5663
#endregion
5764

@@ -91,7 +98,7 @@ public partial class UserManager : MonoBehaviour
9198
public object lockObj = new object();
9299

93100
// 만약 공격당한경우 true 가 되는 변수에요.
94-
public bool attacked = false;
101+
[HideInInspector] public bool attacked = false;
95102

96103
public Queue<AttackVO> atkQueue = new Queue<AttackVO>();
97104

MaybeBossRaid/Jemmun/Assets/01_Script/Skills/ArcherSkills.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ sealed protected override void Awake()
3131

3232
if (charactor.isRemote) return;
3333

34-
SetButton(0, SkillA);
35-
SetButton(1, SkillB);
34+
SetButton(0, "속사", SkillA);
35+
SetButton(1, "강사", SkillB);
3636

3737
}
3838

MaybeBossRaid/Jemmun/Assets/01_Script/Skills/ClericSkill.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ sealed protected override void Awake()
2424

2525
if (charactor.isRemote) return;
2626

27-
SetButton(0, SkillA);
28-
SetButton(1, SkillB);
27+
SetButton(0, "힐", SkillA);
28+
SetButton(1, "강화", SkillB);
2929
}
3030

3131
private void Start()

MaybeBossRaid/Jemmun/Assets/01_Script/Skills/MageSkills.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ sealed protected override void Awake()
2424

2525
if (charactor.isRemote) return;
2626

27-
SetButton(0, SkillA);
28-
SetButton(1, SkillB);
27+
SetButton(0, "폭렬 마법", SkillA);
28+
SetButton(1, "마법 연습", SkillB);
2929
}
3030

3131
private void Start()

MaybeBossRaid/Jemmun/Assets/01_Script/Skills/WarriorSkills.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ sealed protected override void Awake()
3030

3131
if (charactor.isRemote) return;
3232

33-
SetButton(0, SkillA);
34-
SetButton(1, SkillB);
33+
SetButton(0, "휘두르기", SkillA);
34+
SetButton(1, "용기의 함성", SkillB);
3535
}
3636

3737
private void Start()

MaybeBossRaid/Jemmun/Assets/01_Script/Skills/WizardSkills.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ sealed protected override void Awake()
3232

3333
if (charactor.isRemote) return;
3434

35-
SetButton(0, SkillA);
36-
SetButton(1, SkillB);
35+
SetButton(0, "파이어볼", SkillA);
36+
SetButton(1, "비전", SkillB);
3737
}
3838

3939
private void Start()
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
using System;
2+
using System.Collections.Generic;
23

34
[Serializable]
45
public class PlayerDataVO
56
{
67
public int hp;
78
public int mp;
89
public int id;
10+
public JobList job;
911

10-
public PlayerDataVO(int id, int hp, int mp)
12+
public PlayerDataVO(int id, int hp, int mp, JobList job)
1113
{
1214
this.hp = hp;
1315
this.mp = mp;
1416
this.id = id;
17+
this.job = job;
1518
}
16-
}
19+
}

MaybeBossRaid/Jemmun/Assets/01_Script/_Base/Player/CharactorBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ abstract public partial class CharactorBase : MonoBehaviour
88
public int mp = 100;
99
public int pos = 0; // 뭐 하는 변수인지는 이번 동아리 시간에 설명 해 드리겠슴
1010
public int id;
11+
12+
public JobList job = JobList.JOB_END;
13+
1114
//protected string name; // 일단 주석처리 해 두겟스빈다.
1215

1316
// 스텟

MaybeBossRaid/Jemmun/Assets/01_Script/_Base/Skill/Skills.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,20 @@ abstract public class Skills : SkillBase
66
{
77
[Header("스킬 시전 버튼들")]
88
[SerializeField] protected UnityEngine.UI.Button[] btnSkills = new UnityEngine.UI.Button[2];
9+
protected UnityEngine.UI.Text[] txtBtnSkill = new UnityEngine.UI.Text[2];
910

1011
protected override void Awake()
1112
{
1213
base.Awake();
14+
15+
if (charactor.isRemote) return;
16+
17+
// 버튼 텍스트 가져옴
18+
for (int i = 0; i < btnSkills.Length; ++i)
19+
{
20+
txtBtnSkill[i] = btnSkills[i].transform.GetChild(0).GetComponent<UnityEngine.UI.Text>();
21+
}
22+
1323
}
1424

1525
/// <summary>
@@ -19,7 +29,9 @@ protected override void Awake()
1929
/// <param name="skillEnum">스킬의 Enum</param>
2030
public void Skill(SkillEnum skillEnum)
2131
{
22-
32+
// 자신의 턴이 아니면 실행하지 않음
33+
if (!charactor.isTurn) return;
34+
2335
CharactorBase damage = selectedTarget.GetComponent<CharactorBase>();
2436
if (damage == null) return;
2537
SkillData skillData = SkillManager.instance.GetSkillData(skillEnum);
@@ -33,15 +45,18 @@ public void Skill(SkillEnum skillEnum)
3345
DataVO vo = new DataVO("attack", JsonUtility.ToJson(new AttackVO((int)(damage.id * charactor.atk), skillEnum)));
3446

3547
SocketClient.Send(JsonUtility.ToJson(vo));
48+
49+
TurnManager.instance.EndTurn();
3650
}
3751

3852
/// <summary>
3953
/// 버튼에 스킬을 묶어주는 함수
4054
/// </summary>
4155
/// <param name="btnIndex">버튼의 인덱스. 0 ~ 1</param>
4256
/// <param name="function">버튼을 눌렀을 때 실행할 함수</param>
43-
protected void SetButton(int btnIndex, UnityEngine.Events.UnityAction function)
57+
protected void SetButton(int btnIndex, string skillName, UnityEngine.Events.UnityAction function)
4458
{
4559
btnSkills[btnIndex].onClick.AddListener(function);
60+
txtBtnSkill[btnIndex].text = skillName;
4661
}
4762
}

MaybeBossRaid/Jemmun/Assets/01_Script/_Base/_Example/ExampleSkill.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ sealed protected override void Awake()
2222

2323
if (charactor.isRemote) return;
2424

25-
SetButton(0, SkillA);
26-
SetButton(1, SkillB);
25+
SetButton(0, "매우 강력한 공격", SkillA);
26+
SetButton(1, "매우 강력한 힐링", SkillB);
2727
}
2828

2929
private void Start()
Loading

0 commit comments

Comments
 (0)