2019-11-06 13:36:28 +00:00
|
|
|
|
#include "Observer.h"
|
|
|
|
|
#include "AllyCenter.h"
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
{
|
2021-10-28 15:15:51 +00:00
|
|
|
|
// 创建一个战队
|
|
|
|
|
AllyCenterController *controller = new AllyCenterController();
|
|
|
|
|
|
|
|
|
|
// 创建4个玩家,并加入战队
|
|
|
|
|
Player *Jungle = new Player("Jungle");
|
|
|
|
|
Player *Single = new Player("Single");
|
|
|
|
|
Player *Jianmengtu = new Player("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
Player *SillyDog = new Player("ɵ<EFBFBD>ӹ<EFBFBD>");
|
2019-11-06 13:36:28 +00:00
|
|
|
|
controller->join(Jungle);
|
|
|
|
|
controller->join(Single);
|
|
|
|
|
controller->join(Jianmengtu);
|
|
|
|
|
controller->join(SillyDog);
|
|
|
|
|
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
|
2021-10-28 15:15:51 +00:00
|
|
|
|
// Jungle发现物资,呼叫队友
|
2019-11-06 13:36:28 +00:00
|
|
|
|
Jungle->call(RESOURCE, controller);
|
|
|
|
|
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
|
2021-10-28 15:15:51 +00:00
|
|
|
|
// 傻子狗遇到危险,求救队友
|
2019-11-06 13:36:28 +00:00
|
|
|
|
SillyDog->call(HELP, controller);
|
|
|
|
|
|
|
|
|
|
printf("\n\n");
|
|
|
|
|
system("pause");
|
2020-11-29 03:17:40 +00:00
|
|
|
|
|
|
|
|
|
delete controller;
|
|
|
|
|
delete Jungle;
|
|
|
|
|
delete Single;
|
|
|
|
|
delete Jianmengtu;
|
|
|
|
|
delete SillyDog;
|
2022-03-09 23:53:38 +00:00
|
|
|
|
controller = nullptr;
|
|
|
|
|
Jungle = nullptr;
|
|
|
|
|
Single = nullptr;
|
|
|
|
|
Jianmengtu = nullptr;
|
|
|
|
|
SillyDog = nullptr;
|
2020-11-29 03:17:40 +00:00
|
|
|
|
|
2019-11-06 13:36:28 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|