-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHero.cpp
More file actions
32 lines (24 loc) · 683 Bytes
/
Copy pathHero.cpp
File metadata and controls
32 lines (24 loc) · 683 Bytes
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
#include "Hero.h"
#include "NameAction.h"
#include "SideAction.h"
#include "TargetAction.h"
Hero::Hero(const std::string& FileName)
{
std::ifstream HeroFile;
HeroFile.open(FileName);
Name=TagXmlParser::FindTag<std::string>(HeroFile,"Name");
const auto SideString=TagXmlParser::FindTag<std::string>(HeroFile,"Side");
if (SideString=="Hero")
{
Side=HeroDef::Hero;
}
else if(SideString=="Enemy")
{
Side=HeroDef::Enemy;
}
Graphic = std::make_unique<GraphicHero>(HeroFile);
Actions.push_back(HeroDef::ActionPtr(new NameAction));
Actions.push_back(HeroDef::ActionPtr(new SideAction));
Actions.push_back(HeroDef::ActionPtr(new TargetAction));
HeroFile.close();
}