Last change
on this file since 8c74150 was 8dad966, checked in by dportnoy <dmp1488@…>, 12 years ago |
Added server support for player attack animations and cooldowns and firing projectiles for ranged attacks
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | #ifndef _PLAYER_H
|
---|
2 | #define _PLAYER_H
|
---|
3 |
|
---|
4 | #include "Compiler.h"
|
---|
5 |
|
---|
6 | #if defined WINDOWS
|
---|
7 | #include <winsock2.h>
|
---|
8 | #include <WS2tcpip.h>
|
---|
9 | #elif defined LINUX
|
---|
10 | #include <netinet/in.h>
|
---|
11 | #endif
|
---|
12 |
|
---|
13 | #include <string>
|
---|
14 |
|
---|
15 | #include "Common.h"
|
---|
16 | #include "WorldMap.h"
|
---|
17 |
|
---|
18 | using namespace std;
|
---|
19 |
|
---|
20 | class Player {
|
---|
21 | public:
|
---|
22 |
|
---|
23 | enum PlayerClass {
|
---|
24 | CLASS_NONE,
|
---|
25 | CLASS_WARRIOR,
|
---|
26 | CLASS_RANGER
|
---|
27 | };
|
---|
28 |
|
---|
29 | enum AttackType {
|
---|
30 | ATTACK_NONE,
|
---|
31 | ATTACK_MELEE,
|
---|
32 | ATTACK_RANGED
|
---|
33 | };
|
---|
34 |
|
---|
35 | Player();
|
---|
36 | Player(const Player& p);
|
---|
37 | Player(string name, string password);
|
---|
38 |
|
---|
39 | ~Player();
|
---|
40 |
|
---|
41 | void setId(int id);
|
---|
42 | void setAddr(sockaddr_in addr);
|
---|
43 | void setClass(PlayerClass c);
|
---|
44 |
|
---|
45 | void serialize(char* buffer);
|
---|
46 | void deserialize(char* buffer);
|
---|
47 |
|
---|
48 | bool move(WorldMap *map);
|
---|
49 |
|
---|
50 | void takeFlag(int flag, WorldMap *map);
|
---|
51 | void dropFlag(int flag, WorldMap *map);
|
---|
52 |
|
---|
53 | int id;
|
---|
54 | string name;
|
---|
55 | string password;
|
---|
56 | sockaddr_in addr;
|
---|
57 | FLOAT_POSITION pos;
|
---|
58 | POSITION target;
|
---|
59 | unsigned long long timeLastUpdated;
|
---|
60 | unsigned long long timeAttackStarted;
|
---|
61 | bool isAttacking;
|
---|
62 | int targetPlayer;
|
---|
63 |
|
---|
64 | int playerClass;
|
---|
65 | int maxHealth;
|
---|
66 | int health;
|
---|
67 | int attackType;
|
---|
68 | int damage;
|
---|
69 | unsigned long long attackCooldown;
|
---|
70 | int team; // 0 is blue, 1 is red
|
---|
71 | bool hasBlueFlag;
|
---|
72 | bool hasRedFlag;
|
---|
73 | };
|
---|
74 |
|
---|
75 | #endif
|
---|
Note:
See
TracBrowser
for help on using the repository browser.