本文整理汇总了C++中Entity::GetShouldRotateZ方法的典型用法代码示例。如果您正苦于以下问题:C++ Entity::GetShouldRotateZ方法的具体用法?C++ Entity::GetShouldRotateZ怎么用?C++ Entity::GetShouldRotateZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entity
的用法示例。
在下文中一共展示了Entity::GetShouldRotateZ方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CopyEntity
void EntityFactory::CopyEntity(Entity* aTargetEntity, const std::string& aEntityTag)
{
if (myEntities.find(aEntityTag) == myEntities.end())
{
//#ifdef _DEBUG
// if (myEntityTags.find(aEntityTag) == myEntityTags.end())
// {
// std::string error = "[EntityFactory] No entity with name " + aEntityTag;
// DL_ASSERT(error);
// }
//
// LoadEntity(myEntityTags[aEntityTag], myDifficultScale);
//#else
std::string error = "[EntityFactory] No entity with name " + aEntityTag;
DL_ASSERT(error);
//#endif
}
auto it = myEntities.find(aEntityTag);
Entity* sourceEntity = it->second.myEntity;
aTargetEntity->SetName(sourceEntity->GetName());
if (aEntityTag.rfind("Asteroid") != std::string::npos
|| aEntityTag.rfind("asteroid") != std::string::npos
|| aEntityTag.rfind("Junk") != std::string::npos
|| aEntityTag.rfind("junk") != std::string::npos)
{
int value = CU::Math::RandomRange(1, 6);
aTargetEntity->SetShouldRotate(true);
if (value == 1)
aTargetEntity->SetShouldRotateX(true);
else if (value == 2)
aTargetEntity->SetShouldRotateY(true);
else if (value == 3)
aTargetEntity->SetShouldRotateZ(true);
else if (value == 4)
{
aTargetEntity->SetShouldRotateX(true);
aTargetEntity->SetShouldRotateY(true);
}
else if (value == 5)
{
aTargetEntity->SetShouldRotateY(true);
aTargetEntity->SetShouldRotateZ(true);
}
else if (value == 6)
{
aTargetEntity->SetShouldRotateZ(true);
aTargetEntity->SetShouldRotateX(true);
}
}
else
{
aTargetEntity->SetShouldRotate(sourceEntity->GetShouldRotate());
aTargetEntity->SetShouldRotateX(sourceEntity->GetShouldRotateX());
aTargetEntity->SetShouldRotateY(sourceEntity->GetShouldRotateY());
aTargetEntity->SetShouldRotateZ(sourceEntity->GetShouldRotateZ());
}
if (sourceEntity->GetComponent<CollisionComponent>() != nullptr)
{
eCollisionType collisionType = sourceEntity->GetComponent<CollisionComponent>()->GetCollisionType();
if (collisionType == eCollisionType::NORMAL)
{
aTargetEntity->AddComponent<CollisionComponent>();
}
else if (collisionType == eCollisionType::PLANET)
{
aTargetEntity->AddComponent<PlanetCollisionComponent>();
}
aTargetEntity->GetComponent<CollisionComponent>()->Init(it->second.myCollisionSphereRadius);
}
if (sourceEntity->GetComponent<GraphicsComponent>() != nullptr)
{
aTargetEntity->AddComponent<GraphicsComponent>();
switch (it->second.myGraphicsType)
{
case eEntityDataGraphicsType::MODEL:
aTargetEntity->GetComponent<GraphicsComponent>()->Init(it->second.myModelFile.c_str(),
it->second.myEffectFile.c_str());
break;
case eEntityDataGraphicsType::CUBE:
aTargetEntity->GetComponent<GraphicsComponent>()->InitCube(it->second.myWidth,
it->second.myHeight, it->second.myDepth);
break;
default:
break;
}
if (it->second.myScale != CU::Vector3f())
{
aTargetEntity->GetComponent<GraphicsComponent>()->SetScale(it->second.myScale);
if (aTargetEntity->GetComponent<CollisionComponent>() != nullptr)
//.........这里部分代码省略.........