-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cell.cpp
60 lines (51 loc) · 1.31 KB
/
Cell.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
#include "Cell.h"
#include "GameEngine.h"
#include "MyEngine.h"
#include "SelfMovingPhysicalComponent.h"
#include "CellPhysicalComponent.h"
Cell::Cell(GameEngine *engine) : ReplicableGameObject(engine)
{
objectType = cellType;
this->model = &engine->getParentEngine()->getRenderer()->getModels()[Renderer::CELL_MODEL_INDEX];
physicalComponent = new CellPhysicalComponent();
physicalComponent->setGameObject(this);
physicalComponent->setPriority(0);
}
Cell::Cell(GameEngine *engine, RenderableComponent *model, PhysicalComponent *physicalComponent) : ReplicableGameObject(engine, model, physicalComponent, 3)
{
objectType = cellType;
physicalComponent->setPriority(0);
}
Cell::Cell(const Cell &cell) : ReplicableGameObject(cell)
{
objectType = cellType;
physicalComponent->setPriority(0);
}
Cell &Cell::operator=(const Cell &cell)
{
Cell::Cell(cell);
return *this;
}
Cell::~Cell()
{
}
void Cell::replicate()
{
if (false &&GameEngine::CURRENT_CELL_COUNT < GameEngine::MAX_CELL_COUNT && GameEngine::CURRENT_CELL_COUNT < GameEngine::MAX_GAME_OBJECT_COUNT)
{
Cell *cell = new Cell(*this);
engine->addObject(cell);
}
}
void Cell::selfAdd()
{
GameEngine::CURRENT_CELL_COUNT++;
}
void Cell::selfRemove()
{
ReplicableGameObject::selfRemove();
if (gameEngineIndex != UINT_MAX)
{
GameEngine::CURRENT_CELL_COUNT--;
}
}