本文整理汇总了C++中Plane::SetState方法的典型用法代码示例。如果您正苦于以下问题:C++ Plane::SetState方法的具体用法?C++ Plane::SetState怎么用?C++ Plane::SetState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane::SetState方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Update
void Bullet::Update()
{
Particle::Update();
Animation_CurrentFrame = Animation_CurrentFrame % 2;
std::list<Plane*> *curPlanes = Game->GetPlaneObjects();
for( std::list<Plane*>::iterator ptr = curPlanes->begin(); ptr != curPlanes->end(); ptr++ )
{
GameObject* gObj = (GameObject*)(*ptr);
Plane* pObj = (Plane*)(*ptr);
if( pObj != Owner && (Game->Rules_FriendlyFire || pObj->Team != ((Plane*)Owner)->Team) )
{
if( pObj->State == STATE_FLYING || pObj->State == STATE_STALLED || pObj->State == STATE_SHOOT )
{
if( Position->DistanceTo( pObj->Position ) < 24.0 )
{
pObj->SetState( STATE_HIT );
pObj->LastHitBy = (Plane*)Owner;
((Plane*)Owner)->Score++;
ForRemoval = true;
break;
}
}
}
}
}
示例2: Update
void GameStage::Update()
{
GameObject* gObj;
Plane* pObj;
int ObjIdx = 0;
ObjectsToRemove.clear();
for( std::vector<GameObject*>::iterator ptr = Objects.begin(); ptr != Objects.end(); ptr++ )
{
gObj = (GameObject*)(*ptr);
gObj->Update();
if( gObj->ForRemoval )
{
ObjectsToRemove.push_back( ObjIdx );
}
if( Rules_HasGround && gObj->Position->Y >= (Framework::SystemFramework->GetDisplayHeight() / graphicsMultiplier) - 32 )
{
pObj = dynamic_cast<Plane*>(*ptr);
if( pObj != 0 )
{
if( pObj->State != STATE_EXPLODING && pObj->State != STATE_EXPLODED )
{
pObj->LastHitBy = 0;
pObj->SetState( STATE_EXPLODING );
}
} else {
gObj->ForRemoval = true;
ObjectsToRemove.push_back( ObjIdx );
}
}
ObjIdx++;
}
while( (int)ObjectsToRemove.size() > 0 )
{
Objects.erase( Objects.begin() + ObjectsToRemove.back() );
ObjectsToRemove.pop_back();
}
bool AddedObjects = false;
while( (int)ObjectsToAdd.size() > 0 )
{
Objects.push_back( ObjectsToAdd.front() );
ObjectsToAdd.pop_front();
AddedObjects = true;
}
if( AddedObjects )
{
SortObjectsList();
}
// Only process game rules if we're the active stage (ie, highscores will just update planes
if( Framework::SystemFramework->ProgramStages->Current() == this )
{
UpdateByRules();
}
}