本文整理汇总了C++中Tower::setPriority方法的典型用法代码示例。如果您正苦于以下问题:C++ Tower::setPriority方法的具体用法?C++ Tower::setPriority怎么用?C++ Tower::setPriority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tower
的用法示例。
在下文中一共展示了Tower::setPriority方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initializeGame
void initializeGame() {
vector< vector<bool> > tileMap;
int n = MapManager::load(tileMap, Game::pixelsPerSquare, Game::enemiesRoute, "map.tdm");
/// Always after initialize Game::pixelsPerSquare
Game::towerManager = new BasicTowerManager();
if(n==0) {
Game::map.resize(tileMap.size(), vector<Game::TileType>(tileMap[0].size(), Game::TileType::EmptyTile));
for(int i=0; i<tileMap.size(); i++)
for(int j=0; j<tileMap[i].size(); j++)
if(!tileMap[i][j])
Game::map[i][j] = Game::TileType::RoadTile;
} else {
cout << "Error loading map \"map.tdm\". Error: " << n << endl;
cout << "Loading default map." << endl;
Game::pixelsPerSquare = 50;
Game::enemiesRoute.push_back(Vec2i(0,25));
Game::enemiesRoute.push_back(Vec2i(475,25));
Game::enemiesRoute.push_back(Vec2i(475,500));
for(int i=0; i<10; i++)
Game::map.push_back(vector<Game::TileType>(10, Game::TileType::EmptyTile));
for(int i=0; i<10; i++) {
Game::map[i][0] = Game::TileType::RoadTile;
Game::map[9][i] = Game::TileType::RoadTile;
}
Tower* t = new SniperTower();
t->setPosition(Vec2i(3,3));
t->setPriority(Near);
if(!Game::putTower(t))
delete t;
t = new SniperTower();
t->setPosition(Vec2i(4,5));
t->setPriority(Last);
if(!Game::putTower(t))
delete t;
t = new SniperTower();
t->setPosition(Vec2i(5,4));
if(!Game::putTower(t))
delete t;
}
Game::life = 20;
Game::money = 1500;
Game::tickCount = 0;
}