n
This commit is contained in:
1 parent
c82bb0a343
commit
04cda042cb
2 files changed
+36
-12
No files matched your search
+15
-1
@@ -816,13 +816,26 @@ void CStrategySystem::fm_gen() { // TODO 阵型生成
|
||||
}
|
||||
}
|
||||
|
||||
void CStrategySystem::fp_rp() { // 阵型球员相对中央球员的位置
|
||||
CPoint cur_pos[10]{ home1.position, home2.position, home3.position, home4.position, home5.position, home6.position, home7.position, home8.position, home9.position, home10.position };
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (rp[i].id == fm_id() - 1) {
|
||||
rp[i].ang = 0;
|
||||
rp[i].dis = 0;
|
||||
}
|
||||
else {
|
||||
rp[i].ang = atan2(cur_pos[i].y - pos[0].y, cur_pos[i].x - pos[0].x);
|
||||
rp[i].dis = Distance(cur_pos[i], pos[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CStrategySystem::fp_move() { // TODO 阵型球员移动
|
||||
if (fm_id() == 1) {
|
||||
}
|
||||
else if (fm_id() == 2) {
|
||||
}
|
||||
else if (fm_id() == 3) {
|
||||
|
||||
if (ball.position.x >= 157 && ball.position.x <= 290) {
|
||||
struct infor a[11];
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
@@ -3033,6 +3046,7 @@ CStrategySystem::CStrategySystem(int id) {
|
||||
// }
|
||||
|
||||
pos = new CPoint[10];
|
||||
rp = new RelPos[10];
|
||||
|
||||
flag = true;
|
||||
|
||||
|
||||
+21
-11
@@ -3,6 +3,13 @@
|
||||
#ifndef _INSIDE_VISUAL_CPP_STRATEGYSYSTEM
|
||||
#define _INSIDE_VISUAL_CPP_STRATEGYSYSTEM
|
||||
|
||||
// 阵型球员相对中央球员的位置结构体
|
||||
struct RelPos {
|
||||
int id;
|
||||
double dis;
|
||||
double ang;
|
||||
};
|
||||
|
||||
class CStrategySystem : public CObject {
|
||||
DECLARE_DYNAMIC(CStrategySystem)
|
||||
public:
|
||||
@@ -21,14 +28,17 @@ private:
|
||||
void Possession(); // 控球
|
||||
void Goalie(); // 守门
|
||||
|
||||
CPoint *pos; // 球员位置
|
||||
int cp_id(); // 中央球员 ID
|
||||
void cp_pos(); // 中央球员位置
|
||||
void cp_kick(); // 中央球员击球
|
||||
int fm_id(); // 阵型 ID
|
||||
void fm_gen(); // 阵型生成
|
||||
void fp_move(); // 阵型球员移动
|
||||
CPoint coor(int which);//返回机器人的位置
|
||||
CPoint *pos; // 球员位置
|
||||
RelPos *rp; // 阵型球员相对中央球员的位置
|
||||
|
||||
int cp_id(); // 中央球员 ID
|
||||
void cp_pos(); // 中央球员位置
|
||||
void cp_kick(); // 中央球员击球
|
||||
void fp_rp(); // 阵型球员相对中央球员的位置
|
||||
int fm_id(); // 阵型 ID
|
||||
void fm_gen(); // 阵型生成
|
||||
void fp_move(); // 阵型球员移动
|
||||
CPoint coor(int which); // 返回机器人的位置
|
||||
|
||||
// void spin(int which, bool isClockwise); // 自旋
|
||||
void shot1(int which, double o, CPoint t); // 直射
|
||||
@@ -82,9 +92,9 @@ private:
|
||||
Robot2 home1, home2, home3, home4, home5, home6, home7, home8, home9, home10, hgoalie;
|
||||
Robot3 opponent;
|
||||
|
||||
struct infor{
|
||||
int num;//球员编号
|
||||
int dis;//球员到球的距离
|
||||
struct infor {
|
||||
int num; // 球员编号
|
||||
int dis; // 球员到球的距离
|
||||
};
|
||||
bool flag;
|
||||
|
||||
|
||||
Reference in new issue
Block a user