-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAOI_world.h
55 lines (50 loc) · 1.07 KB
/
AOI_world.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
#pragma once
#include <list>
#include <vector>
class AOI_Player {
public:
//有横坐标和纵坐标
virtual int getX() = 0;
virtual int getY() = 0;
};
class grid {
/*存放若干玩家对象(有横坐标和纵坐标的对象)*/
std::list<AOI_Player *> m_players;
public:
void AddPlayer(AOI_Player *_player) {
m_players.push_back(_player);
}
void DelPlayer(AOI_Player *_player) {
m_players.remove(_player);
}
std::list<AOI_Player *> &GetList() {
return m_players;
}
};
class AOI_world
{
/*存储若干格子对象(按照序号访问)*/
std::vector<grid> m_grids;
/*矩形的参数*/
int x_begin;
int x_end;
int y_begin;
int y_end;
/*x轴和y轴分别分几个格子*/
int x_count;
int y_count;
int GetXWildth() {
return (x_end - x_begin) / x_count;
}
int GetYWildth() {
return (y_end - y_begin) / y_count;
}
public:
AOI_world(int _xbegin, int _xend, int _ybegin, int _yend, int _xcount, int _ycount);
virtual ~AOI_world();
/*获取XXX的周围玩家*/
std::list<AOI_Player *> GetSrdPlayers(AOI_Player *_player);
/*添加玩家到游戏世界*/
void AddPlayer(AOI_Player *_player);
void DelPlayer(AOI_Player *_player);
};