本文整理汇总了C++中Opt::ResetDamagedActorIds方法的典型用法代码示例。如果您正苦于以下问题:C++ Opt::ResetDamagedActorIds方法的具体用法?C++ Opt::ResetDamagedActorIds怎么用?C++ Opt::ResetDamagedActorIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opt
的用法示例。
在下文中一共展示了Opt::ResetDamagedActorIds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Collide
void BounceCollisionSubSystem::Collide( Actor& actor, Actor& other )
{
Opt<BounceCollisionComponent> bounceCC = actor.Get<BounceCollisionComponent>();
if (mShotCollisionSubSystem.IsValid() && bounceCC->IsUseShotCollision())
{
mShotCollisionSubSystem->Collide(actor, other);
}
//TODO: for now its wallcc should be a bouncableComponent or this should be a collision class
Opt<WallCollisionComponent> wallCC = other.Get<WallCollisionComponent>();
if( !wallCC.IsValid() )
{
return;
}
Opt<IPositionComponent> positionC = actor.Get<IPositionComponent>();
Opt<IMoveComponent> moveC = actor.Get<IMoveComponent>();
Opt<IPositionComponent> otherPositionC = other.Get<IPositionComponent>();
Opt<ICollisionComponent> otherCC = other.Get<ICollisionComponent>();
if ( !otherPositionC.IsValid() || !otherCC.IsValid() || !positionC.IsValid() )
{
return;
}
double const dx = otherPositionC->GetX() - positionC->GetX();
double const dy = otherPositionC->GetY() - positionC->GetY();
const double h = moveC->GetHeading();
double c = cos( h );
double s = sin( h );
double at = atan2( s, c );
double at2 = atan2( c, s );
if( std::abs( dx ) > std::abs( dy ) )
{
c *= -1;
}
else if( std::abs( dx ) < std::abs( dy ) )
{
s *= -1;
}
moveC->SetHeading( atan2( s, c ) );
moveC->GetSpeed().mBase.Set( moveC->GetSpeed().mBase.Get() * ( 1.0 - bounceCC->GetSpeedLossPercent() ) );
if (bounceCC->GetHitCountToKill() > 0)
{
bounceCC->SetHitCountToKill(bounceCC->GetHitCountToKill() - 1);
}
if (bounceCC->IsResetActorsCollidedOnBounce())
{
bounceCC->ResetDamagedActorIds();
}
}