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


C++ CGameObject::GetNext方法代码示例

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


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

示例1: DebugLayout

void DebugLayout()
{
	float y_offset = 100;

	CPlayer* LocalPlayer;

	if (NetworkManager)
	{
		LocalPlayer = NetworkManager->GetLocalPlayer();

		Render::DrawText(20, y_offset, color_white, DT_LEFT, "R3DNetwork: %x", NetworkManager);
		y_offset += 15;
	}

	CObjectManager* ObjectManager = CObjectManager::Get();

	if (ObjectManager)
	{
		Render::DrawText(20, y_offset, color_white, DT_LEFT, "ObjectManager: %x", ObjectManager);
		y_offset += 15;

		//Finds LocalPlayer in the main menu (For the shooting range)
		if (!LocalPlayer)
		{
			CGameObject* Object = ObjectManager->GetFirst();

			for (CGameObject* Object = ObjectManager->GetFirst(); Object && Object->GetNext(); Object = Object->GetNext())
			{
				if (Object->GetObjectInfo()->m_id == OBJECT_AI_PLAYER)
				{
					LocalPlayer = (CPlayer*)Object;
					break;
				}
			} 
		}
	}

	if (LocalPlayer)
	{
		Render::DrawText(20, y_offset, color_white, DT_LEFT, "LocalPlayer: %x [0x%x]", LocalPlayer, LocalPlayer->GetObjectInfo());
		y_offset += 15;

		for (int slot = 0; slot < SLOT_MAX; slot++)
		{
			Weapon* pWeapon = LocalPlayer->m_weaponSlots[slot];

			if (!pWeapon)
				continue;

			Render::DrawText(40, y_offset, color_white, DT_LEFT, "Slot Weapon %i: %x (CWeaponConfig: %x)", slot, pWeapon, pWeapon->GetWeaponConfig());
			y_offset += 15;
		}

		Render::DrawTextA(20, y_offset, color_white, DT_LEFT, "Health: %f", LocalPlayer->GetHealth());
	}
}
开发者ID:xghozt,项目名称:WarHook,代码行数:56,代码来源:render.cpp


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