本文整理汇总了C++中Tile::GetY方法的典型用法代码示例。如果您正苦于以下问题:C++ Tile::GetY方法的具体用法?C++ Tile::GetY怎么用?C++ Tile::GetY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tile
的用法示例。
在下文中一共展示了Tile::GetY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateTile
void Map::UpdateTile(const Tile& tile)
{
//tile Range Check
if (tile.GetX() < 0 || tile.GetX() >= MAP_ROW) return;
if (tile.GetY() < 0 || tile.GetY() >= MAP_COL) return;
int row = Utility::Instance().RowOfPoint(tile);
int col = Utility::Instance().ColOfPoint(tile);
m_Tiles[row][col].SetTileState(tile.GetTileState());
}
示例2: SetTile
void Map::SetTile(const Tile& tile)
{
//tile Range Check
if (tile.GetX() < 0 || tile.GetX() >= MAP_ROW) return;
if (tile.GetY() < 0 || tile.GetY() >= MAP_COL) return;
int row = Utility::Instance().RowOfPoint(tile);
int col = Utility::Instance().ColOfPoint(tile);
m_Tiles[row][col] = tile;
//printf("(%d,%d)\n", Utility::Instance().RowOfPoint(tile), Utility::Instance().ColOfPoint(tile));
}
示例3: CalculatePath
bool World::CalculatePath(Vector &start, Vector &finish, std::vector<Vector> &path)
{
Tile *start_tile = GetTile(start);
if(!start_tile)
{
return false;
}
Tile *finish_tile = GetTile(finish);
if(!finish_tile)
{
return false;
}
bool result = TileMap::CalculatePath(start_tile, finish_tile);
if(result)
{
for(Tile *tile = GetTile(finish); tile; tile = tile->GetParent())
{
path.emplace(path.begin(),
(TileW * tile->GetX()) + (TileW / 2),
(TileH * tile->GetY()) + (TileH / 2)
);
}
}
return result;
}
示例4:
Tile::Tile(const Tile & src)
{
m_ShipType = src.m_ShipType;
m_ShipId = src.m_ShipId;
m_TileState = src.m_TileState;
SetX(src.GetX());
SetY(src.GetY());
}
示例5: PostProcessTile
void Generator::PostProcessTile(Map& map, Tile& tile, std::map<std::pair<unsigned int, unsigned int>, unsigned int>& tiles, unsigned int id)
{
unsigned int x = tile.GetX();
unsigned int y = tile.GetY();
Tile* tile2 = map.GetTile(x - 1, y);
if (tile2 && !tile2->IsBlocked())
{
std::map<std::pair<unsigned int, unsigned int>, unsigned int>::iterator itr = tiles.find(std::make_pair(tile2->GetX(), tile2->GetY()));
if (itr == tiles.end())
{
tiles.insert(std::make_pair(std::make_pair(tile2->GetX(), tile2->GetY()), id));
PostProcessTile(map, *tile2, tiles, id);
}
}
tile2 = map.GetTile(x + 1, y);
if (tile2 && !tile2->IsBlocked())
{
std::map<std::pair<unsigned int, unsigned int>, unsigned int>::iterator itr = tiles.find(std::make_pair(tile2->GetX(), tile2->GetY()));
if (itr == tiles.end())
{
tiles.insert(std::make_pair(std::make_pair(tile2->GetX(), tile2->GetY()), id));
PostProcessTile(map, *tile2, tiles, id);
}
}
tile2 = map.GetTile(x, y - 1);
if (tile2 && !tile2->IsBlocked())
{
std::map<std::pair<unsigned int, unsigned int>, unsigned int>::iterator itr = tiles.find(std::make_pair(tile2->GetX(), tile2->GetY()));
if (itr == tiles.end())
{
tiles.insert(std::make_pair(std::make_pair(tile2->GetX(), tile2->GetY()), id));
PostProcessTile(map, *tile2, tiles, id);
}
}
tile2 = map.GetTile(x, y + 1);
if (tile2 && !tile2->IsBlocked())
{
std::map<std::pair<unsigned int, unsigned int>, unsigned int>::iterator itr = tiles.find(std::make_pair(tile2->GetX(), tile2->GetY()));
if (itr == tiles.end())
{
tiles.insert(std::make_pair(std::make_pair(tile2->GetX(), tile2->GetY()), id));
PostProcessTile(map, *tile2, tiles, id);
}
}
}