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


C++ CCharacter::LastHammeredBy方法代码示例

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


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

示例1: DoHookers

void CGameControllerSoloFNG::DoHookers()
{
	for(int i = 0; i < MAX_CLIENTS; i++)
	{
		CCharacter *pChr = CHAR(i);
		if (!pChr)
			continue;
		
		int Hooking = pChr->GetHookedPlayer();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			
			if (!pVic || (/*pVic->GetPlayer()->GetTeam() != pChr->GetPlayer()->GetTeam() && */pChr->GetHookTick() < CFG(HookRegisterDelay)))
				Hooking = -1;
			
		}

		int HammeredBy = pChr->LastHammeredBy();
		pChr->ClearLastHammeredBy();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			if (pVic)
			{
				//bool SameTeam = pChr->GetPlayer()->GetTeam() == pVic->GetPlayer()->GetTeam();
				m_aLastInteraction[Hooking] = /*SameTeam ? -1 : */ i;
			}
		}

		if (HammeredBy >= 0)
		{	
			CCharacter *pHam = CHAR(HammeredBy);
			if (pHam)
			{
				//bool SameTeam = pChr->GetPlayer()->GetTeam() == pHam->GetPlayer()->GetTeam();
				m_aLastInteraction[i] = /*SameTeam ? -1 : */ HammeredBy;
				if (/* !SameTeam &&*/ CFG(HammerFreeze) && pChr->GetFreezeTicks() <= 0)
				{
					pChr->Freeze(CFG(HammerFreeze) * TS, HammeredBy);
					m_aFrozenBy[i] = HammeredBy; //suppress kill event being generated
				}
			}
			else
				m_aLastInteraction[i] = -1;
		}
	}
}
开发者ID:TsFreddie,项目名称:teeworlds-solofng,代码行数:50,代码来源:solofng.cpp

示例2: DoHookers

void CGameControllerOpenFNG::DoHookers()
{
	for(int i = 0; i < MAX_CLIENTS; i++)
	{
		CCharacter *pChr = CHAR(i);
		if (!pChr)
			continue;
		
		int Hooking = pChr->GetHookedPlayer();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			if (!pVic || (pVic->GetPlayer()->GetTeam() != pChr->GetPlayer()->GetTeam() && pChr->GetHookTick() < CFG(HookRegisterDelay)))
				Hooking = -1;
		}

		int HammeredBy = pChr->LastHammeredBy();
		pChr->ClearLastHammeredBy();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			if (pVic)
			{
				bool SameTeam = pChr->GetPlayer()->GetTeam() == pVic->GetPlayer()->GetTeam();
				m_aLastInteraction[Hooking] = SameTeam ? -1 : i;
			}
		}
		
		/*
		CPlayer *pPlayer = TPLAYER(Hooking);
			if (pVic)
			{
				bool SameTeam = pChr->GetPlayer()->GetTeam() == pVic->GetPlayer()->GetTeam();
				m_aLastInteraction[Hooking] = SameTeam ? -1 : i;
				if(pPlayer)
				{
				    if (!SameTeam && CFG(HammerFreeze) && pVic->GetFreezeTicks() <= 0)
				    {
					    pVic->Freeze(CFG(HammerFreeze) * TS, i);
					    m_aFrozenBy[Hooking] = i; //suppress kill event being generated
				    }
				}
			}
		*/

		if (HammeredBy >= 0)
		{	
			CCharacter *pHam = CHAR(HammeredBy);
			CPlayer *pPlayer = TPLAYER(HammeredBy);
			if (pHam)
			{
				bool SameTeam = pChr->GetPlayer()->GetTeam() == pHam->GetPlayer()->GetTeam();
				m_aLastInteraction[i] = SameTeam ? -1 : HammeredBy;
				if(pPlayer)
				{
				    if (!SameTeam && CFG(HammerFreeze) && pChr->GetFreezeTicks() <= 0 && pPlayer->m_HammerFreeze)
				    {
					    pChr->Freeze(CFG(HammerFreeze) * TS, HammeredBy);
					    m_aFrozenBy[i] = HammeredBy; //suppress kill event being generated
				    }
				}
			}
			else
				m_aLastInteraction[i] = -1;
		}
	}
}
开发者ID:Schwertspize,项目名称:speedfng,代码行数:69,代码来源:openfng.cpp


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