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


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

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


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

示例1: Tick

void CBuilding::Tick()
{
	if (m_Type == BUILDING_SAWBLADE)
	{
		CCharacter *pChr = GameServer()->m_World.ClosestCharacter(m_Pos, m_ProximityRadius*1.4f, 0);
		if(pChr && pChr->IsAlive())
			pChr->TakeSawbladeDamage(m_Pos);
	}
	
	 // effect testing on all buildings
	//if (GameServer()->Server()->Tick()%40 == 1)
	//	GameServer()->CreateEffect(FX_BARREL, m_Pos);


	if (m_SetTimer > 0)
		m_SetTimer--;
	
	if (m_Type == BUILDING_FLAMETRAP)
	{
		// on / off
		if (m_TriggerTimer < GameServer()->Server()->Tick() - GameServer()->Server()->TickSpeed() * 3.0f)
			m_TriggerTimer = GameServer()->Server()->Tick() + GameServer()->Server()->TickSpeed() * 2.0f;
		
		// if on
		if (m_TriggerTimer > GameServer()->Server()->Tick())
		{
			m_aStatus[BSTATUS_FIRE] = 1;
			
			// small delay before settings players to aflame
			if (m_TriggerTimer > GameServer()->Server()->Tick() && m_TriggerTimer < GameServer()->Server()->Tick() + GameServer()->Server()->TickSpeed() * 1.7f)
			{
				{
					CCharacter *pChr = GameServer()->m_World.ClosestCharacter(m_Pos + vec2((m_Mirror ? -50 : 50), -4), m_ProximityRadius, 0);
				
					if(pChr && pChr->IsAlive())
					{
						pChr->TakeDamage(vec2(0, 0), 2, NEUTRAL_BASE, DEATHTYPE_FLAMETRAP, vec2(0, 0), DAMAGETYPE_FLAME);
						pChr->SetAflame(2.5f, NEUTRAL_BASE, DEATHTYPE_FLAMETRAP);
					}
				}
				{
					CCharacter *pChr = GameServer()->m_World.ClosestCharacter(m_Pos + vec2((m_Mirror ? -102 : 102), -4), m_ProximityRadius*1.3f, 0);
				
					if(pChr && pChr->IsAlive())
					{
						pChr->TakeDamage(vec2(0, 0), 2, NEUTRAL_BASE, DEATHTYPE_FLAMETRAP, vec2(0, 0), DAMAGETYPE_FLAME);
						pChr->SetAflame(2.5f, NEUTRAL_BASE, DEATHTYPE_FLAMETRAP);
					}
				}
			}
		}
		else
			m_aStatus[BSTATUS_FIRE] = 0;
	}

	
	// destruction
	if (m_DeathTimer > 0)
	{
		m_DeathTimer--;

		if (m_Life <= 0 && m_DeathTimer <= 0)
		{
			// turret?
			Destroy();
			//GameServer()->m_World.DestroyEntity(this);
		}
	}
	else
	if (m_SetTimer <= 0 && (m_Type == BUILDING_MINE1 || m_Type == BUILDING_MINE2))
	{
		CCharacter *pChr = GameServer()->m_World.ClosestCharacter(m_Pos, m_ProximityRadius*1.7f, 0);
		if(pChr && pChr->IsAlive() && !pChr->IsSliding())// && (pChr->GetPlayer()->GetTeam() != m_Team || !GameServer()->m_pController->IsTeamplay()))
		{
			if (pChr->GetPlayer()->GetTeam() != m_Team || !GameServer()->m_pController->IsTeamplay())
			{
				m_DeathTimer = 1;
				m_Life = 0;
			}
		}
	}
	
	UpdateStatus();
}
开发者ID:Henningstone,项目名称:Ninslash,代码行数:84,代码来源:building.cpp


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