-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobjectmanager.cpp
73 lines (69 loc) · 2.27 KB
/
objectmanager.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
#include "objectmanager.h"
namespace SSJ {
int ObjectManager::nextId = 0;
void ObjectManager::CreateMainPlayer(Json::Value object, int indeks)
{
MainPlayer* Temp = new MainPlayer();
Temp->SynchronizationObject(object);
if(indeks == -1)
DataContainer::ObjectLists.push_back(Temp);
else
DataContainer::ObjectLists[indeks] = Temp;
DataContainer::MainPlayer = Temp;
LayerContainer::GetGameLayer("druga")->addObject(Temp);
}
void ObjectManager::CreatePlayer(Json::Value object, int indeks)
{
Player* Temp = new Player();
Temp->SynchronizationObject(object);
if(indeks == -1)
DataContainer::ObjectLists.push_back(Temp);
else
DataContainer::ObjectLists[indeks] = Temp;
LayerContainer::GetGameLayer("trzecia")->addObject(Temp);
}
void ObjectManager::CreateBullet(Json::Value object, int indeks){
Bullet* Temp ;
switch(static_cast<JsonOption>(object[_J(_weaponType)].asInt())){
case Uzi:
Temp = BulletFactory::CreateUziBullet();
break;
case Ak47:
Temp = BulletFactory::CreateAk47Bullet();
break;
case Bazooka:
Temp = BulletFactory::CreateBazookaBullet();
break;
case Glock:
Temp = BulletFactory::CreateGlockBullet();
break;
case SniperRifle:
Temp = BulletFactory::CreateSniperRifleBullet();
break;
case M16:
Temp = BulletFactory::CreateM16Bullet();
break;
case Knife:
Temp = BulletFactory::CreateKnifeBullet();
break;
case Shotgun:
Temp = BulletFactory::CreateShotgunBullet();
break;
case Grenade:
Temp = BulletFactory::CreateGrenadeBullet();
break;
}
Temp->SynchronizationObject(object);
if(indeks == -1)
DataContainer::ObjectLists.push_back(Temp);
else
DataContainer::ObjectLists[indeks] = Temp;
LayerContainer::GetGameLayer("trzecia")->addObject(Temp);
}
void ObjectManager::CreateWeapon(Json::Value object){
Weapon* Temp = new Weapon;
Temp->SynchronizationObject(object);
DataContainer::ObjectLists.push_back(Temp);
LayerContainer::GetGameLayer("trzecia")->addObject(Temp);
}
}