当前位置: 首页>>代码示例>>C++>>正文


C++ Plane::SetState方法代码示例

本文整理汇总了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;
				 }
			}
		}
	}
}
开发者ID:pmprog,项目名称:SkySupreme,代码行数:26,代码来源:bullet.cpp

示例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();
	}

}
开发者ID:pmprog,项目名称:SkySupreme,代码行数:60,代码来源:game.cpp


注:本文中的Plane::SetState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。