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


C++ Mover::SetMoverType方法代码示例

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


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

示例1: OpenLevelFromFile

bool LevelFileIO::OpenLevelFromFile(const char * cFilePath, LevelScene * pScene){
	if(pScene && pScene->GridOk()){
		ifstream FileIn(cFilePath);
		if(FileIn.is_open()){
			string LineReader;
			FileIn >> LineReader;
			if(LineReader == "Foof72"){
				int GridWidth = 0, GridHeight = 0;
				FileIn >> GridWidth;
				FileIn >> GridHeight;
				pScene->InitializeGrid(GridWidth, GridHeight);
				for(int y = 0; y < GridHeight; y++){
					//const int YSkip = y * GridWidth;
					for(int x = 0; x < GridWidth; x++){
						//const int Index = YSkip + x;
						int GridValue = 0;
						FileIn >> GridValue;
						pScene->SetGridUnit(x,y,GridValue);
					}
				}
				//Then Player
				float PlayerX, PlayerY;
				FileIn >> PlayerX;
				FileIn >> PlayerY;
				pScene->SetPlayerStart(PlayerX, PlayerY);
				pScene->ResetPlayerPosition();
				FileIn >> pScene->ExitPos_X >> pScene->ExitPos_Y;


				//Then props if any
				//Ignore grand object total
				int nProps = 0;
				FileIn >> nProps;
				FileIn >> nProps;
				if(nProps > 0){
					for(int i = 0; i < nProps; i++){
						PropStruct * pProp = new PropStruct;
						pProp->bIsSelected = false;
						FileIn >> pProp->uType;
						pProp->uType++;
						FileIn >> pProp->x;
						FileIn >> pProp->y;

						pProp->nID = pScene->PropList.size();
						pProp->uObjectType = PropStruct::Collectible;
						pScene->PropList.push_back(pProp);
					}
				}
				int nEnemies = 0;
				FileIn >> nEnemies;
				if(nEnemies > 0){
					for(int i = 0; i < nEnemies; i++){
						PropStruct * pProp = NULL;
	
						unsigned int Type = 0;
						float X = 0.0f, Y = 0.0f;
						FileIn >> Type;
						FileIn >> X;
						FileIn >> Y;
						
						
						
						ExtendedObject * ExtendedInfo = Globals::DynamicSet[Type];
						switch(ExtendedInfo->SubType){
							case 2:{
								pProp = new Mover;
								Mover * pMover = (Mover*)pProp;
								float Speed, Width, Pause;
								unsigned int FunctionType, MoverType;
								FileIn >> FunctionType
									>> MoverType 
									>> pMover->OriginX
									>> pMover->OriginY
									>> Speed
									>> Width
									>> Pause
									>> pMover->Sync;
								pMover->SetSpeed(Speed);
								pMover->SetPause(Pause);
								pMover->SetWidth(Width);
								pMover->SetMoverType(MoverType);
								pMover->SetFunctionType(FunctionType);
								break;
							}
							case 3:{
								pProp = new PropStruct;
								break;
							}
							case 0:{
								pProp = new PropStruct;
								float Eater;
								FileIn >> Eater >> Eater;
								break;
							}
							case 5:{
								pProp = new PropStruct;
								float Eater;
								FileIn >> Eater >> Eater;
								break;
							}
//.........这里部分代码省略.........
开发者ID:JIoffe,项目名称:Flame-Broiled-Fury-BETA,代码行数:101,代码来源:LevelFileIO.cpp


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