Ejemplo n.º 1
0
void CBoss3::SetTarget(float x, float y)
{
	_target.x = x;
	_target.y = y;
	SetWeapon(CResourcesManager::GetInstance()->_weapon_enemy);
	Attacking();
}
Ejemplo n.º 2
0
void CTrap::update()
{
	CBox::update();

	Attacking();

}
Ejemplo n.º 3
0
void CSniperBlock::SetTarget(float x, float y)
{
	CEnemyUseGun::SetTarget(x, y);
	if (_target_angle >= 90 && _target_angle <= 270)
	{
		Attacking();
	}
	
}
Ejemplo n.º 4
0
void CRunmanFire::SetTargetAttack(float x, float y)
{
	if (_physical.n == 0) return; //Đang lơ lững thì k bắn

	float distance_x = _physical.x > x ? _physical.x - x : x - _physical.x;
	float distance_y = _physical.y > y ? _physical.y - y : y - _physical.y;

	if (distance_y <= ENEMY_RUN_MAN_FIRE_ATTACK_DISTANCE &&
		distance_x <= ENEMY_RUN_MAN_FIRE_ATTACK_DISTANCE + 30 &&
		_count_bullet < ENEMY_RUN_MAN_FIRE_MAX_BULLET &&
		_rm_status == RMRun)
	{
		SetWeapon(CResourcesManager::GetInstance()->_weapon_enemy);
		Attacking();
	}
}
Ejemplo n.º 5
0
/********************************************************************************
Hero Update
********************************************************************************/
void CPlayerInfo::HeroUpdate(float timeDiff, CAIManager* ai_manager, GameObjectFactory* go_manager, CMap* map, Sound UpdateSound)
{
	if(currentState != DYING)
	{
		// Update Hero's info
		switch(currentState)
		{
		case CPlayerInfo::KNOCKED_BACKING:
			{
				moving(timeDiff, map);
			}
			break;
		case CPlayerInfo::ATTACKING:
			{
				Attacking(timeDiff, ai_manager, go_manager, UpdateSound);
			}
			break;
		default:
			{
				Vector3 HeroPrevPos = theHeroPosition;
				moving(timeDiff, map);
				if(currentState == MOVING)
				{
					moveAnimation(timeDiff, HeroPrevPos);
				}
			}
			break;
		}
		if(currentState == NIL)
		{
			if(theHeroCurrentPosNode->posType != 0
				&& theHeroCurrentPosNode->posType < CPosNode::TOTAL_ACTIVE_GO)
			{
				if(CheckCollisionCurrent())
				{
					CollisionResponseCurrent();
				}
			}
		}

		// Flicker hero when got damaged
		if(justGotDamged)
		{
			if(timeElasped < 1.f)
			{
				timeElasped += timeDiff;
				if(unrenderOrRenderTimeLeft < 0.02f)
				{
					unrenderOrRenderTimeLeft += timeDiff;
				}
				else
				{
					unrenderOrRenderTimeLeft = 0.f;
					if(RenderHero)
					{
						RenderHero = false;
					}
					else
					{
						RenderHero = true;
					}
				}
			}
			else
			{
				timeElasped = 0.f;
				unrenderOrRenderTimeLeft = 0.f;
				justGotDamged = false;
				RenderHero = true;
			}
		}
	}
	else
	{
		// Death animation
		if(timeElasped < 2.f)
		{
			if(theHeroCurrentPosNode->posType == CPosNode::HOLE)
			{
				holeDropScale -= timeDiff;
				if(holeDropScale < 0.1)
					holeDropScale = 0.1;
			}
			timeElasped += timeDiff;
			heroAnimationCounter += 20 * timeDiff;
			if(heroAnimationCounter > 5.0f)
				heroAnimationCounter = 5.0f;
		}
	}
}