-
Notifications
You must be signed in to change notification settings - Fork 0
/
unit.h
66 lines (62 loc) · 1.63 KB
/
unit.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
#ifndef _UNIT_H_
#define _UNIT_H_
#include <Ogre.h>
#include <string>
#include <map>
#include "stats.h"
#include "item.h"
#include "player.h"
class Stats;
class Player;
class Armor;
class Weapon;
class Unit {
public:
enum Anim_State{NONE,IDLE,WALK,ATTACK,DEATH,FLINCH};
protected:
Ogre::Entity * entity;
Ogre::SceneNode * sn;
int x;
int y;
Anim_State animState; //animation to use in update;
Ogre::AnimationState *currAnim;
Ogre::Vector3 initial_direction;
Ogre::Quaternion orientation;
std::string charName;
std::map<Anim_State,std::string> animations;
Player *owner;
Armor * armor;
Weapon * weapon;
public:
//STATS
Stats stats;
int yoffset;
Player * getOwner();
std::string getCharName();
void setAnimState(Anim_State state);
~Unit();
virtual void update(Ogre::Real time,Player *p1,Player *p2);
Unit(Ogre::SceneManager *s,Player *owner,std::string name, std::string mesh, Ogre::Vector3 v,Ogre::Vector3 init,Stats stats);
void equipWeapon(Weapon * w);
void equipArmor(Armor * a);
Ogre::Entity * getEntity();
Ogre::SceneNode * getSceneNode();
void move(int x,int y);
int getX();
int getY();
void setX(int x);
void setY(int y);
bool inRange(int x, int y);
virtual void update(Ogre::Real time);
Unit::Anim_State getAnimState();
Ogre::Vector3 getDirection();
Ogre::Vector3 getInitialDirection();
void setDirection(Ogre::Vector3 direction);
void setInitialDirection(Ogre::Vector3 direction);
void setOrientation(Ogre::Quaternion q);
Ogre::Quaternion getOrientation();
std::string attacked(Unit *u,int h1, int h2); //return dmg dealt
bool isAlive();
void reset();
};
#endif