-
Notifications
You must be signed in to change notification settings - Fork 0
/
HeroFactory.cpp
77 lines (71 loc) · 1.75 KB
/
HeroFactory.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
#include "HeroFactory.h"
AbstractUnit::ptr HeroFactory::createUnit(
Ogre::Vector3 StartDestination,
//int player_id,
//char type_id,
//char Class,
//char Weapon,
//char Armor,
//char AP,
//short HP,
UnitDef ud,
Ogre::String Name,
Ogre::Vector3 StartDirection)
{
#ifdef _USE_ASSERTS_
assert(m_bConfigured);
#endif
m_Units.push_back(AbstractUnit::ptr(new Hero(m_pSceneManager,
StartDestination, ud, //PlayerID, type_id, Class, Weapon, Armor, AP, HP,
Name, StartDirection)));
m_Units.back()->setAnimation("Idle");
return m_Units.back();
}
AbstractUnit::ptr HeroFactory::createUnit(
Ogre::Real X, Ogre::Real Y, Ogre::Real Z,
//int player_id,
//char type_id,
//char Class,
//char Weapon,
//char Armor,
//char AP,
//short HP,
UnitDef ud,
Ogre::String Name,
Ogre::Vector3 StartDirection)
{ return createUnit(X, Y, Z, ud, /*PlayerID,type_id,Class,Weapon,Armor,AP,HP,*/ Name, StartDirection); }
AbstractUnit::ptr HeroFactory::createUnit(
Ogre::Vector3 StartDestination,
//int player_id,
//char type_id,
//char Class,
//char Weapon,
//char Armor,
//char AP,
//short HP,
UnitDef ud,
Ogre::String Name)
{
return createUnit(StartDestination, ud, //PlayerID, type_id, Class, Weapon, Armor, AP, HP,
Name, _DATA.getInitialDirection(ud.type_id));
}
AbstractUnit::ptr HeroFactory::createUnit(
Ogre::Real X, Ogre::Real Y, Ogre::Real Z,
//int player_id,
//char type_id,
//char Class,
//char Weapon,
//char Armor,
//char AP,
//short HP,
UnitDef ud,
Ogre::String Name)
{
return createUnit(X, Y, Z, ud, //PlayerID, type_id, Class, Weapon, Armor, AP, HP,
Name, _DATA.getInitialDirection(ud.type_id));
}
HeroFactory& HeroFactory::getInstance(void)
{
static HeroFactory instance;
return instance;
}