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


C++ CGameManager::GetCurrentPlayer方法代码示例

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


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

示例1: MessageProc


//.........这里部分代码省略.........
				}
				if (pSMSG->GetEffects().size() != 0)
				{
					for (unsigned int i = 0; i < pSMSG->GetEffects().size(); ++i)
					{
						pUnit->PushEffect(CAbilityManager::GetInstance()->GetAbility(pSMSG->GetEffects()[i]),1);
					}

				}
			}
		}
		break;
	case MSG_DESPAWNUNIT:
		{
			CDespawnUnitMessage* pSMSG = dynamic_cast<CDespawnUnitMessage*>(pMsg);
			if (CGameplayState::GetInstance()->GetSelectedUnit() == pSMSG->GetUnit())
			{
				CGameplayState::GetInstance()->ClearSelections();
			}
			CTile* tile = CTileManager::GetInstance()->GetTile(pSMSG->GetUnit()->GetPos().nPosX, pSMSG->GetUnit()->GetPos().nPosY);

			int nUnitID = pSMSG->GetUnit()->GetUniqueID();
			if (tile != nullptr)
			{
				tile->SetIfOccupied(false);
				if (pSMSG->GetUnit()->GetType() != UT_SKELETON)
					tile->SetIfDeadTile(true);
			}
			if (pSMSG->GetUnit() == CGameplayState::GetInstance()->GetHighlighted())
				CGameplayState::GetInstance()->ClearHighlighted();
			CObjectManager::GetInstance()->RemoveObject(pSMSG->GetUnit());
			if(pSMSG->GetUnit()->GetType() == UT_HERO || pSMSG->GetUnit()->GetType() == UT_CASTLE)
			{
				if(pThis->GetCurrentPlayer()->GetAI())
				{
					CGameOverState::GetInstance()->SetAI(true);
				}
				else
				{
					CGameOverState::GetInstance()->SetAI(false);
					if(pSMSG->GetUnit()->GetPlayerID() == 0)
						CGameOverState::GetInstance()->SetPlayer(2);
					else if(pSMSG->GetUnit()->GetPlayerID() == 1)
						CGameOverState::GetInstance()->SetPlayer(1);
				}
				CStateStack::GetInstance()->Push(CGameOverState::GetInstance());
			}

			if (pSMSG->GetUnit()->GetPlayerID() != pThis->GetCurrentPlayer()->GetPlayerID())
			{
				pThis->GetCurrentPlayer()->SetExp(pThis->GetCurrentPlayer()->GetExp() + (pSMSG->GetUnit()->GetEXPValue()*3));
				pThis->GetCurrentPlayer()->GetStats()->nPlayerEXPEarned+=pSMSG->GetUnit()->GetEXPValue();
				switch (pSMSG->GetUnit()->GetType())
				{
				case UT_SWORDSMAN:
					pThis->GetCurrentPlayer()->GetStats()->nSwordsmanKilled++;
					break;
				case UT_ARCHER:
					pThis->GetCurrentPlayer()->GetStats()->nArcherKilled++;
					break;
				case UT_CAVALRY:
					pThis->GetCurrentPlayer()->GetStats()->nCavalryKilled++;
					break;
				}
			}
开发者ID:Jon-Stumpfel,项目名称:league-of-champion-craft,代码行数:66,代码来源:GameManager.cpp


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