Beispiel #1
0
void	cBattlePhase::Update(float e_fElpaseTime)
{
	if( m_pBattleAttack )
	{
		m_pBattleAttack->Update(e_fElpaseTime);
		float	l_fPower = m_pBattleAttack->GetPower();
		if( l_fPower != -1.f )
		{
			if( l_fPower <= 0.01f )
			{
				m_pMainRoleData->SetCurrentWorkingObject(eMTMRS_ATTACK_FAILED);
				cGameApp::SoundPlay(L"MagicTower/Sound/AttackSound1.wav",true);
			}
			else
			{
				m_pMainRoleData->SetCurrentWorkingObject(eMTMRS_ATTACK);
				cGameApp::SoundPlay(L"MagicTower/Sound/AttackSound2.wav",true);
			}
			m_pBattleAttack->Init();
			m_pMonsterBase->SetCurrentWorkingObject(eMTMS_HURT);
		}
		else
		{
			if(m_pMainRoleData->GetCurrentWorkingObjectIndex() != eMTMRS_IDLE)
			{
				if( m_pMainRoleData->GetCurrentWorkingObject()->IsAnimationDone() )
				{
					switch(m_pMainRoleData->GetCurrentWorkingObjectIndex())
					{
						case eMTMRS_ATTACK:
							ProcessAttack();
							break;
					}
					m_pMainRoleData->SetCurrentWorkingObject(eMTMRS_IDLE);
				}
			}
		}
	}
	if( m_pBattleDefence )
		m_pBattleDefence->Update(e_fElpaseTime);
	m_pMainRoleData->Update(e_fElpaseTime);
	if( m_pMonsterBase )
		m_pMonsterBase->Update(e_fElpaseTime);
	if( m_pMonsterBase->GetStatus()->m_iHP <= 0 )
	{
		m_pGridBehavior->SetWorking(false);
		this->m_bSatisfiedCondition = true;
	}
}
Beispiel #2
0
void ZBrain::Think( float fDelta)
{
	if ( m_pBody->isThinkAble())
	{
		MUID prevTarget = m_uidTarget;


		// 타겟 찾기
		bool bFind = FindTarget();


		// 타겟이 있으면...
		if ( bFind)
		{
			// 길찾기
			ProcessBuildPath( fDelta);


			// 공격
			ProcessAttack( fDelta);
		}

		// 타겟이 없으면...
		else if ( prevTarget != MUID( 0, 0))
		{
			m_pBody->Stop();
			m_pBody->m_TaskManager.Clear();

			MakeNeglectUpdateTime();
	
			m_pBody->OnNeglect( 1);
		}
	}


	// Check neglect
	DWORD dwCurrTime = timeGetTime();
	if ( !m_pBody->m_TaskManager.IsEmpty())
		MakeNeglectUpdateTime();

	else if ( dwCurrTime > m_dwNeglectTimer)
	{
		m_pBody->OnNeglect( 1);

		MakeNeglectUpdateTime();
	}
}