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


C++ C_TFPlayer::HasItem方法代码示例

本文整理汇总了C++中C_TFPlayer::HasItem方法的典型用法代码示例。如果您正苦于以下问题:C++ C_TFPlayer::HasItem方法的具体用法?C++ C_TFPlayer::HasItem怎么用?C++ C_TFPlayer::HasItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在C_TFPlayer的用法示例。


在下文中一共展示了C_TFPlayer::HasItem方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateStatus

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CTFHudFlagObjectives::UpdateStatus( void )
{
	C_TFPlayer *pLocalPlayer = ToTFPlayer( C_BasePlayer::GetLocalPlayer() );

	// are we carrying a flag?
	CCaptureFlag *pPlayerFlag = NULL;
	if ( pLocalPlayer && pLocalPlayer->HasItem() && ( pLocalPlayer->GetItem()->GetItemID() == TF_ITEM_CAPTURE_FLAG ) )
	{
		pPlayerFlag = dynamic_cast<CCaptureFlag*>( pLocalPlayer->GetItem() );
	}

	if ( pPlayerFlag )
	{
		m_bCarryingFlag = true;

		// make sure the panels are on, set the initial alpha values, 
		// set the color of the flag we're carrying, and start the animations
		if ( m_pCarriedImage && !m_bFlagAnimationPlayed )
		{
			m_bFlagAnimationPlayed = true;

			// Set the correct flag image depending on the flag we're holding
			switch (pPlayerFlag->GetTeamNumber())
			{
				case TF_TEAM_RED:
					m_pCarriedImage->SetImage("../hud/objectives_flagpanel_carried_red");
					break;	
				case TF_TEAM_BLUE:
					m_pCarriedImage->SetImage("../hud/objectives_flagpanel_carried_blue");
					break;
				case TF_TEAM_GREEN:
					m_pCarriedImage->SetImage("../hud/objectives_flagpanel_carried_green");
					break;
				case TF_TEAM_YELLOW:
					m_pCarriedImage->SetImage("../hud/objectives_flagpanel_carried_yellow");
					break;
			}

			if (m_pRedFlag && m_pRedFlag->IsVisible())
			{
				m_pRedFlag->SetVisible(false);
			}

			if ( m_pBlueFlag && m_pBlueFlag->IsVisible() )
			{
				m_pBlueFlag->SetVisible( false );
			}

			if (m_pGreenFlag && m_pGreenFlag->IsVisible())
			{
				m_pGreenFlag->SetVisible(false);
			}

			if (m_pYellowFlag && m_pYellowFlag->IsVisible())
			{
				m_pYellowFlag->SetVisible(false);
			}

			if ( !m_pCarriedImage->IsVisible() )
			{
				m_pCarriedImage->SetVisible( true );
			}

			g_pClientMode->GetViewportAnimationController()->StartAnimationSequence( "FlagOutline" );

			if ( m_pCapturePoint )
			{
				if ( !m_pCapturePoint->IsVisible() )
				{
					m_pCapturePoint->SetVisible( true );
				}

				if ( pLocalPlayer )
				{
					// go through all the capture zones and find ours
					for ( int i = 0; i < g_CaptureZones.Count(); i++ )
					{
						C_BaseEntity *pZone = ClientEntityList().GetEnt( g_CaptureZones[i] );

						if ( pZone )
						{
							if ( pZone->GetTeamNumber() == pLocalPlayer->GetTeamNumber() )
							{
								m_pCapturePoint->SetEntity( pZone );
							}
						}
					}
				}
			}
		}
	}
	else
	{
		// were we carrying the flag?
		if ( m_bCarryingFlag )
		{
			m_bCarryingFlag = false;
//.........这里部分代码省略.........
开发者ID:treetoon,项目名称:TF2Classic,代码行数:101,代码来源:tf_hud_flagstatus.cpp


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