本文整理汇总了C++中NPC::setAccelXRate方法的典型用法代码示例。如果您正苦于以下问题:C++ NPC::setAccelXRate方法的具体用法?C++ NPC::setAccelXRate怎么用?C++ NPC::setAccelXRate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPC
的用法示例。
在下文中一共展示了NPC::setAccelXRate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpawnNPC
void NinjaSpawner::SpawnNPC(const float posX,
const float posY,
bool playSoundEffect,
std::string animationFile,
Vector3 & dimensions,
Vector3 & collisionDimensions,
Vector2 & collisionBoxOffset)
{
float randJumpSpeed = rand() % 4000;
randJumpSpeed *= 0.001;
randJumpSpeed += 20;
float randMaxXVelocity = rand() % 3000;
randMaxXVelocity *= 0.001;
randMaxXVelocity += 10;
int randZ = rand() % 20;
NPC * npc = new NPC(posX, posY, 49 + (randZ * 0.1f));
npc->m_animationFile = animationFile;
npc->m_drawAtNativeDimensions = false;
npc->m_dimensions = Vector3(dimensions.X, dimensions.Y, 0);
npc->m_isAnimated = true;
npc->SetMaxVelocityXYZ(randMaxXVelocity, 99999, 0);
npc->SetCollisionDimensions(Vector3(collisionDimensions.X, collisionDimensions.Y, 0));
npc->SetCollisionBoxOffset(Vector2(collisionBoxOffset.X, collisionBoxOffset.Y));
npc->SetPlayer(GameObjectManager::Instance()->GetPlayer());
npc->SetResistanceXYZ(1.0, 1.4f, 0);
npc->setAccelXRate(1.0);
npc->SetMaterial(MaterialManager::Instance()->GetMaterial("demon1"));
npc->SetMaxJumpSpeed(randJumpSpeed);
npc->SetIsPlayerEnemy(true);
GameObjectManager::Instance()->AddGameObject(npc);
// show some effects when we spawn - smoke
ParticleEmitterManager::Instance()->CreateRadialSpray(50,
Vector3(npc->X(), npc->Bottom(), npc->Z() - 1.0f),
Vector3(3200, 1200, 0),
(rand() % 3) > 1 ? "Media\\smoke3.png" : "Media\\smoke4.png",
4.5f,
6.0f,
0.5f,
1.0f,
100,
200,
0.5,
false,
0.5,
1.0,
800,
true,
2.2,
0.0f,
0.5f,
10,
50);
if (playSoundEffect)
{
AudioManager::Instance()->PlaySoundEffect("explosion\\explosion.wav");
}
}