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


C++ EntityManager::GetLastEntity方法代码示例

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


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

示例1: Update

void TriggerSystem::Update(double pDeltaTime)
{
	if (mCreateNextLevel)
	{
		mCurrentLevel++;
		//if we have enough maps
		if (mMapNames.size() - 1 >= mCurrentLevel)
		{
			LevelManager::GetInstance()->GenerateWorld(mMapNames[mCurrentLevel]);
		}
		mCreateNextLevel = false;
	}



	EntityManager* tEntMan = tEntMan->GetInstance();
	ComponentTable* tCompTable = tCompTable->GetInstance();

	int tMaxEnt = tEntMan->GetLastEntity();

	mNumOfBallsActive = 0;
	mNumOfGoalBlocksActive = 0;

	//check how many balls we have active and goals cause why not
	for (int i = 0; i < tMaxEnt; i++)
	{
		if (tCompTable->HasComponent(i, LabelType))
		{
			Label tLabel = GetComponent<LabelComponent>(i)->mLabel;

			if (tLabel == Label::Ball)
			{
				mNumOfBallsActive++;
			}
			else if (tLabel == Label::GoalBlock)
			{
				mNumOfGoalBlocksActive++;
			}
		}
	}

	//if no goal blocks, we go to next map, even if we can do this by event, we might explode or something that doesn't trigger, not sure how we want it
	if (mNumOfGoalBlocksActive == 0 && mNumOfBallsActive != 0)
	{
		//DEBUG
#ifdef _DEBUG
		cout << "WARNING - MAP HAS NO GOAL LEFT, EITHER WRONG IN MAP OR SOME REALLY WIERD BUG" << endl;
#endif
		//END DEBUG
	}

	


}
开发者ID:Tleety,项目名称:TAJMS-Agil-Breakout,代码行数:55,代码来源:TriggerSystem.cpp

示例2: Update

void InputSystem::Update(double pDeltaTime)
{
	mKeyState = SDL_GetKeyboardState(NULL);
	CheckKeyboard();
	//HandleInput();

	EntityManager* tEntManager = tEntManager->GetInstance();
	ComponentTable* tCompTable = tCompTable->GetInstance();
	int tMaxEnt = tEntManager->GetLastEntity();

	for (int i = 0; i < tMaxEnt; i++)
	{
		if (tCompTable->HasComponent(i, ComponentType::LabelType))
		{
			LabelComponent* tLabel = GetComponent<LabelComponent>(i);

			if (tLabel->mLabel == Label::Pad)
			{
				//find input we want to check for TODO:: maybe fix input into bit array?
				HandleInput(i);
			}
		}
	}


	//cout << "running input system";
	//EventManager::Payload tPayload;
	//tPayload["test"] = MessageInt(5);

 //	void* tDebugData = malloc(4);
	//void* tDebugData2 = malloc(4);
	//*(int*)tDebugData = 4;
	//*(int*)tDebugData2 = 5;

	////memcpy(tDebugData, &data, 4);
	////memcpy(tDebugData2, &data2, 4);
	//tPayload["Debugdata"] = tDebugData;
	//tPayload["Test"] = tDebugData2;
	//cout << "Sending event";
	//mEventManager->BroadcastEvent("DebugTest", tPayload);
	//cout << "event sent, resuming input system update";




}
开发者ID:Tleety,项目名称:TAJMS-Agil-Breakout,代码行数:46,代码来源:InputSystem.cpp


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