-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUnit.h
80 lines (63 loc) · 1.67 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef _UNIT_H
#define _UNIT_H
#include <Ogre.h>
#include "Tile.h"
#include <vector>
#include "Level.h"
#include "Projectile.h"
class Unit
{
public:
Unit(Ogre::Vector3 position, Ogre::SceneManager* sceneManager, int controlledByPlayerNumber, int type, int id=-1);
~Unit();
void setPosition(Ogre::Vector3 position);
Ogre::Vector3 getPosition();
void setRotation(Ogre::Degree rotation);
void setScale(Ogre::Vector3 scale);
Ogre::Quaternion getOrientation();
void setOrientation(Ogre::Quaternion a);
Ogre::Vector3 getScale();
virtual void update(Level* level, std::vector<Projectile*>* projectiles);
int getType();
int getPlayerControlledBy();
void setPlayerControlledBy(int i);
int getUnitID();
void setDestination(Tile* tile, Level* level);
bool isMoving();
Ogre::Vector3 getDirectionMoving();
virtual void setVisible(bool value) = 0;
void setSelected(bool value);
Tile* getCurrentTile();
void setTarget(Unit* unit);
void setTarget(Building* building, Tile* tile);
virtual void attack(std::vector<Projectile*>* projectiles) = 0;
void takeDamage(double amount);
bool isDead();
void setDead(bool a);
void lock();
void unlock();
protected:
std::list<Tile*>* path;
Tile* currentTile;
double movementSpeed;
int id;
int health;
int damage;
Ogre::SceneNode* selectionNode;
Ogre::SceneNode* node;
Ogre::SceneManager* manager;
int controlledByPlayerNumber;
int type;
bool isMovingAlongPath;
Ogre::Vector3 directionMoving;
std::mutex mutex;
Unit* targetUnit;
Building* targetBuilding;
Tile* targetBuildingTile;
int shootingRange;
bool inRange;
bool dead;
private:
std::list<Tile*>* findPath(Tile*** tiles, Tile* endTile, int width, int height);
};
#endif