1 Star 0 Fork 0

Mrack/ MyShapez

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Trash.cpp 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
Mrack 提交于 2024-06-25 13:02 . 5555555
#include "Trash.h"
#include "gamemap.h"
Trash::Trash(GridVec pos, int name, int direction)
: Building(pos, name, direction)
{
}
bool Trash::IsPlace(const GridVec &click, int picdirection, GameMap &gamemap)
{
// 如果超出地图范围,返回false
if (pos.i < 0 || pos.i >= GameInfo::HEIGHT || pos.j < 0 || pos.j >= GameInfo::WIDTH)
{
return false;
}
// 如果在矿地上,或有障碍物,返回false
if (gamemap.GetResource(pos))
{
return false;
}
// 如果点击的是hub,返回false
if (gamemap.GetBuilding(pos))
{
if (gamemap.GetBuilding(pos)->name == BuildingType::HUB || gamemap.GetBuilding(pos)->name == BuildingType::CUTTER || gamemap.GetBuilding(pos)->name == BuildingType::TRASH)
{
return false;
}
}
return true;
}
std::vector<GridVec> Trash::BuildingAllPos()
{
std::vector<GridVec> result = {pos};
return result;
}
void Trash::Receive(GridVec source, int directionin, int shapename)
{
return;
}
bool Trash::CanReceive(GridVec source, int directionin, int shapename)
{
return true;
}
void Trash::TickableRunning()
{
return;
}
void Trash::UpdateTickableState(GameMap &gamemap)
{
return;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/stucky/MyShapez-new.git
[email protected]:stucky/MyShapez-new.git
stucky
MyShapez-new
MyShapez
master

搜索帮助