当前位置: 首页>>代码示例>>C++>>正文


C++ Spell::getType方法代码示例

本文整理汇总了C++中Spell::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ Spell::getType方法的具体用法?C++ Spell::getType怎么用?C++ Spell::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Spell的用法示例。


在下文中一共展示了Spell::getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dispatchClickDragInput

/*
*	dispatchClickDragInput
*/
void InGameState::dispatchClickDragInput(int iX, int iY, int eX,int eY,int screeniX,int screeniY){
	if(!game->getGSM()->isGameInProgress()){
		int overlayState= game->getGSM()->getOverlayGameState();
		map<int,GUIScreenOverlay*>::iterator find=overlayWorkers.find(overlayState);
		if(find!=overlayWorkers.end())(*find).second->dispatchClickDrag(screeniX,screeniY,eX,eY);
		return;
	}
	Viewport *vp = game->getGUI()->getViewport();
	
	if( screeniY < vp->getViewportHeight()+vp->getViewportOffsetY() ){
		int gameEX=eX+vp->getViewportX()-vp->getViewportOffsetX();
		int gameEY=eY+vp->getViewportY()-vp->getViewportOffsetY();
		if (canCastSpell() && !isCursorBusy()){
			Spell* p = toolbar.getCurrentSpell();	
			if(p!=NULL && p->getType()==clickdrag){
					if(p->getManaCost(game,iX,iY,gameEX,gameEY)<=this->mainPlayer->mana){
						mainPlayer->mana-=p->getManaCost(game,iX,iY,gameEX,gameEY);
						p=p->clone();
						//iX+=vp->getViewportX()-vp->getViewportOffsetX();
						//iY+=vp->getViewportY()-vp->getViewportOffsetY();
						p->start(game,iX,iY,gameEX,gameEY);
						p->owner=mainPlayer;
						spells.push_back(p);
					}
				
			}
			if(p!=NULL && p->getType()==click){
						mainPlayer->mana-=p->getManaCost(game,iX,iY,gameEX,gameEY);
						//iX+=vp->getViewportX()-vp->getViewportOffsetX();
						//iY+=vp->getViewportY()-vp->getViewportOffsetY();
						p=p->clone();
						p->start(game,iX,iY);
						p->owner=mainPlayer;
						spells.push_back(p);
					}
				
			
		}
		
	}

}
开发者ID:ChuckNice,项目名称:SBU_Sources,代码行数:45,代码来源:InGameState.cpp

示例2: 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;
			}
		}
	}
}
开发者ID:ChuckNice,项目名称:SBU_Sources,代码行数:91,代码来源:InGameState.cpp

示例3: copy

void Spell::copy(const Spell& otherSpell) {
	setDescription(otherSpell.getDescription());
	setType(otherSpell.getType());
	setMagicPowerCost(otherSpell.getMagicPowerCost());
}
开发者ID:Rage2Play,项目名称:Cpp,代码行数:5,代码来源:Spell.cpp


注:本文中的Spell::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。