本文整理汇总了C++中Opt::SetOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ Opt::SetOrientation方法的具体用法?C++ Opt::SetOrientation怎么用?C++ Opt::SetOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opt
的用法示例。
在下文中一共展示了Opt::SetOrientation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddProjectiles
void WeaponItemSubSystem::AddProjectiles( Actor& actor, Projectiles_t& projectiles, Scatter& scatter, bool alt/*=false*/ )
{
double actorOrientation = actor.Get<IPositionComponent>()->GetOrientation();
int scat = int( scatter.GetCalculated() * 1000 );
if( scat )
{
double realScatter = ( RandomGenerator::global()() % ( scat + 1 ) - scat / 2. );
L2( "realScatter:%f\n", realScatter );
actorOrientation += ( RandomGenerator::global()() % ( scat + 1 ) - scat / 2. ) * 0.001 * boost::math::double_constants::pi;
}
L2( "calculated and updated scatter:%f\n", scatter.GetCalculated() );
Opt<IPositionComponent> actorPositionC = actor.Get<IPositionComponent>();
for( Projectiles_t::iterator i = projectiles.begin(), e = projectiles.end(); i != e; ++i )
{
Actor& Proj = **i;
SetProjectilePosition( Proj, actor );
Opt<ShotCollisionComponent> shotCC = Proj.Get<ICollisionComponent>();
if ( shotCC.IsValid() )
{
shotCC->SetParentGUID( actor.GetGUID() );
}
Opt<IOwnerComponent> ownerC = Proj.Get<IOwnerComponent>();
if ( ownerC.IsValid() && ownerC->GetOwnerGUID() == -1 ) //if proj owner is set, then not the given actor is the owner
{
ownerC->SetOwnerGUID( actor.GetGUID() );
}
Opt<IPositionComponent> projPositionC = Proj.Get<IPositionComponent>();
projPositionC->SetOrientation( projPositionC->GetOrientation() + actorOrientation );
Opt<IMoveComponent> moveC( Proj.Get<IMoveComponent>() );
if ( moveC.IsValid() )
{
moveC->SetHeading( projPositionC->GetOrientation() );
}
mScene.AddActor( &Proj );
}
}