-
Notifications
You must be signed in to change notification settings - Fork 3
/
game_role.h
56 lines (50 loc) · 1.18 KB
/
game_role.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
#pragma once
#include <zinx.h>
#include "AOI_world.h"
#include "GameMsg.h"
class game_role :
public Irole,public AOI_Player
{
/*定义ID和姓名*/
int iPid = 0;
std::string m_username = "abc";
/*定义坐标*/
float x = 0;//横坐标
float y = 0;
float z = 0;//纵坐标
float v = 0;
/*绑定的输出协议*/
Iprotocol *pGameProtocol = NULL;
//构造一个包含id和名称的消息
GameMsg *MakeLoginIdName();
//构造周围玩家消息
GameMsg *MakeSrdPlayers();
//构造自己出生位置的消息
GameMsg *MakeInitPos();
//构造断开的消息
GameMsg *MakeLogoff();
//构造广播聊天消息
GameMsg *MakeTalkBroadCast(std::string _content);
//构造新位置广播消息
GameMsg *MakeNewPostionBroadCast();
/*处理移动消息*/
void proc_new_position(float _x, float _y, float _z, float _v);
/*视野消失*/
void view_lost(game_role *_old_srd);
/*视野出现*/
void view_appear(game_role *_new_srd);
public:
game_role();
virtual ~game_role();
void bind_protocol(Iprotocol *_proto)
{
pGameProtocol = _proto;
}
// 通过 Irole 继承
virtual bool Init() override;
virtual UserData * ProcMsg(UserData & _poUserData) override;
virtual void Fini() override;
// 通过 AOI_Player 继承
virtual int getX() override;
virtual int getY() override;
};