当前位置: 首页>>代码示例>>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;未经允许,请勿转载。