當前位置: 首頁>>代碼示例>>C++>>正文


C++ Billboard::setColour方法代碼示例

本文整理匯總了C++中Billboard::setColour方法的典型用法代碼示例。如果您正苦於以下問題:C++ Billboard::setColour方法的具體用法?C++ Billboard::setColour怎麽用?C++ Billboard::setColour使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Billboard的用法示例。


在下文中一共展示了Billboard::setColour方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: harmCheck

void Monster::harmCheck(float timeSinceLastFrame)
{
	
	/// 先檢查地形,更新怪物信息
	checkCellType();
	checkMonsterIsChange();
	
	mCheckMethod->bulletHarmCheck(mMonsterState->getBulletState(), mBulletHarmValue, mBulletHarmTime, mBlood, mSpeedPre, mSpeedCurrent, mSpeedTemp, timeSinceLastFrame);
	mCheckMethod->terrainHarmCheck(mMonsterState->getTerrainState(), mTerrainHarmvalue, mBlood, mSpeedPre, mSpeedCurrent, mSpeedTemp, timeSinceLastFrame);
	/// 狀態恢複
	stateRecover();
	
	/// 判斷是否死亡
	//mIsDead = mCheckMethod->checkIsDead(mBlood);
	if (!mIsDead && mCheckMethod->checkIsDead(mBlood))
	{
		mIsDead = true;
		Stage::playSound("../Media/Sound/dead.wav", false);
	}
	/// 根據地形改地圖
	changeMazeByTerrain(mMonsterState->getTerrainState());
	/// 改變頭頂血量顯示
	Billboard* health = mHealthHUD->getBillboard(0);
	float healthPer = mBlood / mMaxBlood;
	float healthLength = healthPer * mHealthHUD->getDefaultWidth();
	health->setDimensions(healthLength, mHealthHUD->getDefaultHeight());
	ColourValue maxHealthCol = ColourValue(0, 0.8f, 0);
	ColourValue minHealthCol = ColourValue(1, 0, 0);
	ColourValue currHealthCol = maxHealthCol * healthPer + minHealthCol * (1 - healthPer);
	health->setColour(currHealthCol);

	// 設置是否顯示著火和冰凍
	if (!mFrozenPs)
		mFrozenPs = (ParticleSystem*)mNode->getAttachedObject(mNode->getName() + "frozen");
	if (!mBurnPs)
		mBurnPs = (ParticleSystem*)mNode->getAttachedObject(mNode->getName() + "burn");
	if (mMonsterState->getBulletState() == "ice")
	{
		mBurnPs->setVisible(false);
		mFrozenPs->setVisible(true);
	}
	else if (mMonsterState->getBulletState() == "fire")
	{
		mBurnPs->setVisible(true);
		mFrozenPs->setVisible(false);
	}
	else
	{
		mBurnPs->setVisible(false);
		mFrozenPs->setVisible(false);
	}
}
開發者ID:kidsang,項目名稱:GlassTD2,代碼行數:52,代碼來源:Monster.cpp

示例2: createBillboard

void BillboardSetComponent::createBillboard(const PonykartParsers::BillboardBlock* const block)
{
	Billboard* bb = billboardSet->createBillboard(block->getVectorProperty("Position")); // make our billboard
	// set its color if it has one, and a rotation
	auto quatIt=block->getQuatTokens().find("colour");
	if (quatIt != block->getQuatTokens().end())
		bb->setColour(toColourValue(quatIt->second));
	bb->setRotation(Degree(block->getFloatProperty("Rotation", 0)));

	auto rectQIt = block->getQuatTokens().find("texturecoords");
	if (rectQIt != block->getQuatTokens().end())
		bb->setTexcoordRect(rectQIt->second.x, rectQIt->second.y, rectQIt->second.z, rectQIt->second.w);

	// It's best to not do this unless we really need to since it makes it less efficient
	auto fTokens = block->getFloatTokens();
	auto heightIt=fTokens.find("height"), widthIt=fTokens.find("width");
	if (heightIt!=fTokens.end() && widthIt!=fTokens.end())
		bb->setDimensions(widthIt->second, heightIt->second);
}
開發者ID:Nuke928,項目名稱:PonyKart,代碼行數:19,代碼來源:BillboardSetComponent.cpp


注:本文中的Billboard::setColour方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。