forked from DUCKSOO/ToonHeroes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EnemyManager.cpp
121 lines (96 loc) · 2.23 KB
/
EnemyManager.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
114
115
116
117
118
119
120
121
#include "EnemyManager.h"
#include "Core.h"
CEnemyManager::CEnemyManager()
{
}
CEnemyManager::~CEnemyManager()
{
}
void CEnemyManager::init()
{
memset(m_pEnemyList, 0, sizeof(m_pEnemyList));
}
void CEnemyManager::setScene(Layer * _curScene)
{
this->init();
int curType = ENEMY_ZOMBIE_FE;
for (int i = 0; i < MAX_ENEMY; i++)
{
m_pEnemyList[i] = new CEnemy;
m_pEnemyList[i]->init(curType);
if (i == 50)
curType = ENEMY_ZOMBIE_MALE;
_curScene->addChild(m_pEnemyList[i]);
}
}
void CEnemyManager::action(float _dt)
{
for (int i = 0; i < MAX_ENEMY; i++)
{
if (m_pEnemyList[i]->getLiveFlag() == true)
{
m_pEnemyList[i]->action(_dt);
}
}
}
void CEnemyManager::createZombie_Fe()
{
for (int i = 0; i < MAX_ENEMY; i++)
{
if (m_pEnemyList[i]->m_iTag == ENEMY_ZOMBIE_FE)
{
if (m_pEnemyList[i]->m_bLiveFlag == false)
{
m_pEnemyList[i]->m_iHP = 30;
m_pEnemyList[i]->m_bLiveFlag = true;
m_pEnemyList[i]->getEnemySprite()->setPosition(Core::sharedManager()->PlayerStartPos); //스프라이트의 위치를 변경해줘야함.
return;
}
}
}
}
/*
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 CEnemyManager::createZombie_Male()
{
for (int i = 0; i < MAX_ENEMY; i++)
{
if (m_pEnemyList[i]->getTag() == ENEMY_ZOMBIE_MALE)
{
if (m_pEnemyList[i]->getLiveFlag() == false)
{
m_pEnemyList[i]->setHp(30);
m_pEnemyList[i]->setLiveFlag(true);
m_pEnemyList[i]->getEnemySprite()->setPosition(Core::sharedManager()->EnemyStartPos); //스프라이트의 위치를 변경해줘야함.
return;
}
}
}
}
void CEnemyManager::dealloc()
{
for (int i = 0; i < MAX_ENEMY; i++)
{
delete(m_pEnemyList[i]);
}
}