forked from DUCKSOO/ToonHeroes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAllianceManager.cpp
113 lines (101 loc) · 2.65 KB
/
AllianceManager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include "AllianceManager.h"
#include "Core.h"
void AllianceManager::init() // 원점 초기화 함수
{
memset(m_pAllianceList, 0, sizeof(m_pAllianceList));
}
void AllianceManager::setScene(Layer* _curScene) //이미지 설정 , 기준점 변경, 좌표 설정, 레이어에 add
{
this->init();
int curType = SWORD;
for (int i = 0; i < MAX_ALLIANCE; i++)
{
m_pAllianceList[i] = new Object_Alliance;
m_pAllianceList[i]->init(curType);
if (i == 50)
curType = M_NINJA;
else if (i == 100)
curType = F_NINJA;
_curScene->addChild(m_pAllianceList[i]);
}
}
void AllianceManager::action(float _dt)
{
for (int i = 0; i < MAX_ALLIANCE; i++)
{
if (m_pAllianceList[i]->m_bLiveFlag == true)
{
m_pAllianceList[i]->action(_dt);
}
}
}
void AllianceManager::createSwordAlliance()
{
if (Core::sharedManager()->m_iMP >= 20.f)
{
for (int i = 0; i < MAX_ALLIANCE; i++)
{
if (m_pAllianceList[i]->m_iTag == SWORD)
{
if (m_pAllianceList[i]->m_bLiveFlag == false)
{
Core::sharedManager()->m_iMP -= 20.f;
Core::sharedManager()->IM->PlusMp(Core::sharedManager()->m_iMP);
m_pAllianceList[i]->m_iHP = 5;
m_pAllianceList[i]->m_bLiveFlag = true;
m_pAllianceList[i]->allianceSprite->setPosition(Core::sharedManager()->PlayerStartPos); //스프라이트의 위치를 변경해줘야함.
return;
}
}
}
}
}
void AllianceManager::createNinJaMaleAlliance()
{
if (Core::sharedManager()->m_iMP >= 25.f)
{
for (int i = 0; i < MAX_ALLIANCE; i++)
{
if (m_pAllianceList[i]->m_iTag == M_NINJA)
{
if (m_pAllianceList[i]->m_bLiveFlag == false)
{
Core::sharedManager()->m_iMP -= 25.f;
Core::sharedManager()->IM->PlusMp(Core::sharedManager()->m_iMP);
m_pAllianceList[i]->m_iHP = 5;
m_pAllianceList[i]->m_bLiveFlag = true;
m_pAllianceList[i]->allianceSprite->setPosition(Core::sharedManager()->PlayerStartPos); //스프라이트의 위치를 변경해줘야함.
return;
}
}
}
}
}
void AllianceManager::createNinJaFemaleAlliance()
{
if (Core::sharedManager()->m_iMP >= 30.f)
{
for (int i = 0; i < MAX_ALLIANCE; i++)
{
if (m_pAllianceList[i]->m_iTag == F_NINJA)
{
if (m_pAllianceList[i]->m_bLiveFlag == false)
{
Core::sharedManager()->m_iMP -= 30.f;
Core::sharedManager()->IM->PlusMp(Core::sharedManager()->m_iMP);
m_pAllianceList[i]->m_iHP = 5;
m_pAllianceList[i]->m_bLiveFlag = true;
m_pAllianceList[i]->allianceSprite->setPosition(Core::sharedManager()->PlayerStartPos); //스프라이트의 위치를 변경해줘야함.
return;
}
}
}
}
}
void AllianceManager::dealloc() // 동적 할당 풀기 ( 종료 시 or 스테이지 이동 시 시행 )
{
for (int i = 0; i < MAX_ALLIANCE; i++)
{
delete(m_pAllianceList[i]);
}
}