?? robot.h
字號:
/*--------------------------------------------------------------------------
Robot.h header file
----------------------------------------------------------------------------*/
/*
* Robot.h 聲明了用戶必須實現的事件處理函數和執行函數函數,
* 用戶可以根據需要在相應的函數中加入代碼來控制機器人的運作。
* 該文件中聲明的一系列結構和函數提供了用戶編程需要的基本信息。
*/
#include "Body.h"
#include "Gun.h"
#include "Radar.h"
#include "Event.h"
#include "Map.h"
#ifndef _Include_Robot
#define _Include_Robot
/////////////////////////////////////////////////////////////
//戰斗地圖
extern struct Map map;
//在事件處理函數被調用前相應的事件信息被放到這些結構中,
//當相應的事件處理函數執行時可以用到這些結構中的信息。
extern struct ScannedRobotEvent scannedRobotEvent;
extern struct BulletHitEvent bulletHitEvent;
extern struct HitByBulletEvent hitByBulletEvent;
extern struct HitRobotEvent hitRobotEvent;
extern struct HitWallEvent hitWallEvent;
extern struct RobotDeathEvent robotDeathEvent;
extern struct BeginEvent beginEvent;
extern struct FinishEvent finishEvent;
extern struct OvertimeEvent overtimeEvent;
/////////////////////////////////////////////////////////////
/*
* 執行函數,每個執行周期被調用一次
*/
void work(void);
//////////////////////////////////////////////////////////////
//事件處理函數,相應事件發生時被觸發
/*
* 當雷達掃描到敵人時觸發
*/
void onScannedRobot(void);
/*
* 當打中某個敵人時觸發
*/
void onBulletHit(void);
/*
* 當被敵人打中時觸發
*/
void onHitByBullet(void);
/*
* 當撞到其它敵人時觸發
*/
void onHitRobot(void);
/*
* 當撞到墻時觸發
*/
void onHitWall(void);
/*
* 當某個敵人死時觸發
*/
void onRobotDeath(void);
/*
* 當開始一輪新的戰斗時觸發
*/
void onBegin(void);
/*
* 當一輪戰斗結束時觸發
*/
void onFinish(void);
/*
* 當機器人執行操作超時時觸發
*/
void onOvertime(void);
///////////////////////////////////////////////////////////////////////
/**
* 在控制臺輸出信息
*/
void println(char * s);
/**
* 得到當前輸出
*/
char * getOutput(void);
///////////////////////////////////////////////////////////////////////
// 這些函數返回一些關于機器人當前狀態的信息
/*
* 得到當前時間
*/
long getTime(void);
/*
* 得到當前的比賽輪數
*/
int getCurrentRound(void);
/*
* 得到總的比賽輪數
*/
int getTotalRounds(void);
/*
* 得到剩余能量
*/
double getEnergy(void);
/*
* 得到當前的比賽得分
*/
double getScore(void);
/*
* 得到當前敵人總數
*/
int getOthers(void);
////////////////////////////////////////////////////////////////////
// 這些函數由系統調用,設置一些關于機器人當前狀態的信息,
// 用戶對這些函數的調用是無效的
/*
* 設置當前時間
*/
void setTime(long t);
/*
* 設置當前的比賽輪數
*/
void setCurrentRound(int r);
/*
* 設置總的比賽輪數
*/
void setTotalRounds(int t);
/*
* 設置剩余能量
*/
void setEnergy(double e);
/*
* 設置當前的比賽得分
*/
void setScore(double s);
/*
* 設置當前敵人總數
*/
void setOthers(int o);
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -