-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathExplosionManager.h
83 lines (81 loc) · 2.7 KB
/
ExplosionManager.h
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
#pragma once
#include "global.h"
#include "Manager_Template.h"
#include "ExplosionEmitter.h"
#include "SharedLuaCallback.h"
//#include "Timeshift.h"
using namespace std;
class ExplosionManager: public Singleton<ExplosionManager>
{
public:
ExplosionManager();
~ExplosionManager();
void init();
void spawnExplosion(Vector3 pos,Vector3 scale);
void spawnExplosionEx(Vector3 pos,Vector3 scale,String sound,String psys);
void spawnExplosionNosound(Vector3 pos,Vector3 scale);
void upd(const FrameEvent& evt);
void cleanup();
static int explosion(lua_State* pL)
{
int n = lua_gettop(pL);
if (n!=6)
{
return 0;
}
if (lua_isstring(pL, 1)&&lua_isstring(pL, 2)&&lua_isstring(pL, 3)&&lua_isstring(pL, 4)&&lua_isstring(pL,5)&&lua_isstring(pL, 6))
{
Vector3 pos = Vector3(StringConverter::parseReal(lua_tostring(pL, 1)),
StringConverter::parseReal(lua_tostring(pL, 2)),
StringConverter::parseReal(lua_tostring(pL, 3)));
Vector3 size = Vector3(StringConverter::parseReal(lua_tostring(pL, 4)),
StringConverter::parseReal(lua_tostring(pL, 5)),
StringConverter::parseReal(lua_tostring(pL, 6)));
SharedLuaCallback::getSingleton().shared_explosion(pos,size);
}
return 1;
}
static int explosion2(lua_State* pL)
{
int n = lua_gettop(pL);
if (n!=8)
{
return 0;
}
if (lua_isstring(pL, 1)&&lua_isstring(pL, 2)&&lua_isstring(pL, 3)&&lua_isstring(pL, 4)
&&lua_isstring(pL,5)&&lua_isstring(pL, 6)&&lua_isstring(pL, 7)&&lua_isstring(pL, 8))
{
Vector3 pos = Vector3(StringConverter::parseReal(lua_tostring(pL, 1)),
StringConverter::parseReal(lua_tostring(pL, 2)),
StringConverter::parseReal(lua_tostring(pL, 3)));
Vector3 size = Vector3(StringConverter::parseReal(lua_tostring(pL, 4)),
StringConverter::parseReal(lua_tostring(pL, 5)),
StringConverter::parseReal(lua_tostring(pL, 6)));
String snd = lua_tostring(pL, 7);
String pSys = lua_tostring(pL, 8);
SharedLuaCallback::getSingleton().shared_explosion(pos,size,snd,pSys);
}
return 1;
}
static int explosionNosound(lua_State* pL)
{
int n = lua_gettop(pL);
if (n!=6)
{
return 0;
}
if (lua_isstring(pL, 1)&&lua_isstring(pL, 2)&&lua_isstring(pL, 3)&&lua_isstring(pL, 4)&&lua_isstring(pL,5)&&lua_isstring(pL, 6))
{
Vector3 pos = Vector3(StringConverter::parseReal(lua_tostring(pL, 1)),
StringConverter::parseReal(lua_tostring(pL, 2)),
StringConverter::parseReal(lua_tostring(pL, 3)));
Vector3 size = Vector3(StringConverter::parseReal(lua_tostring(pL, 4)),
StringConverter::parseReal(lua_tostring(pL, 5)),
StringConverter::parseReal(lua_tostring(pL, 6)));
SharedLuaCallback::getSingleton().shared_explosion_ns(pos,size);
}
return 1;
}
private:
std::vector<ExplosionEmitter*> explosions;
};