本文整理汇总了C++中Tower::isDead方法的典型用法代码示例。如果您正苦于以下问题:C++ Tower::isDead方法的具体用法?C++ Tower::isDead怎么用?C++ Tower::isDead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tower
的用法示例。
在下文中一共展示了Tower::isDead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleClickInput
/*
* handleClickInput - if shift is held, then user is wanting to select units,
* and no spell will cast. Otherwise the selected spell, if a single-click
* type spell, will cast.
*/
void InGameState::handleClickInput(int x, int y,int screenX,int screenY){
if(!game->getGSM()->isGameInProgress()){
int overlayState= game->getGSM()->getOverlayGameState();
map<int,GUIScreenOverlay*>::iterator find=overlayWorkers.find(overlayState);
if(find!=overlayWorkers.end())(*find).second->handleClick(screenX,screenY);
return;
}
Viewport *vp = game->getGUI()->getViewport();
Cursor *c = game->getGUI()->getCursor(GS_GAME_IN_PROGRESS);
toolbar.handleClick(game,screenX,screenY);
displayUnits.handleClick(this,game,x,y);
//spDBToolbar.handleClick(this, game, screenX, screenY);
if(!isCursorBusy()){
vector<Tower*>::iterator beginTower=towers.begin(), endTower=towers.end();
b2Vec2 scaleMouse(x,y);
scaleMouse*=BOX2D_Scale_Factor;
for(;beginTower!=endTower;)
{
Tower* t = *beginTower;
if(!t->isDead()){
if(t->p==mainPlayer){
b2AABB rct=t->getAABB();
if(rct.lowerBound.x<scaleMouse.x && rct.lowerBound.y<scaleMouse.y &&
rct.upperBound.x>scaleMouse.x && rct.upperBound.y>scaleMouse.y){
t->mouseClick(game,screenX,screenY);
}
}
beginTower++;
}else{
beginTower=towers.erase(beginTower);
endTower=towers.end();
}
}
vector<Building*>::iterator beginOther=buildings.begin(), endOther=buildings.end();
for(;beginOther!=endOther;)
{
Building* t = *beginOther;
if(!t->isDead()){
if(t->p==mainPlayer){
b2AABB rct=t->getAABB();
if(rct.lowerBound.x<scaleMouse.x && rct.lowerBound.y<scaleMouse.y &&
rct.upperBound.x>scaleMouse.x && rct.upperBound.y>scaleMouse.y){
t->mouseClick(game,screenX,screenY);
}
}
beginOther++;
}
else{
beginOther=buildings.erase(beginOther);
endOther=buildings.end();
}
}
}
if( screenY < vp->getViewportHeight()+vp->getViewportOffsetY() ){
if (canCastSpell() && !isCursorBusy()){
Spell* p = toolbar.getCurrentSpell();
if(p!=NULL && p->getType()==click){
//x+=vp->getViewportX()-vp->getViewportOffsetX();
//y+=vp->getViewportY()-vp->getViewportOffsetY();
if(p->getManaCost(game,x,y,0,0)<=this->mainPlayer->mana){
mainPlayer->mana-=p->getManaCost(game,x,y,0,0);
p=p->clone();
p->start(game,x,y);
p->owner=mainPlayer;
spells.push_back(p);
}
}
//c->setActiveCursorID(2);
}
else{
if(currentBuilding!=NULL&& mappable){
if(!mainPlayer->getWizard()->buildingsTutorials){
tutSys->currentTutorial="BuildBarracks";
game->getGSM()->setOverlayGameState(TUTSYSSCREENOVERLAYNUM);
mainPlayer->getWizard()->buildingsTutorials=true;
}
this->addBuilding(currentBuilding,bx,by,this->players[0]);
currentBuilding=NULL;
}
}
}
}