示例#1
0
//------------------------------------------------------------------------
void CBurst::Update(float frameTime, uint32 frameId)
{
	CSingle::Update(frameTime, frameId);

	if (m_firing)
	{
		m_bursting = true;

		if (m_next_shot <= 0.0f)
		{
			// workaround: save current burst rate, and fake it so that the CanFire check in CSingle::Shoot passes...
			float saved_next_burst=m_next_burst;
			m_next_burst=0.0f;

			if(m_pShared->burstparams.noSound)
				m_firing = Shoot(true,true,true);
			else
				m_firing = Shoot(true);
			m_burst_shot = m_burst_shot+1;

			if (!m_firing || (m_burst_shot >= m_pShared->burstparams.nshots))
			{
				m_bursting = false;
				m_firing = false;
				m_burst_shot = 1;
			}

			m_next_burst=saved_next_burst;
		}
	}

	m_next_burst -= frameTime;
	if (m_next_burst <= 0.0f)
		m_next_burst = 0.0f;
}
示例#2
0
//------------------------------------------------------------------------
void CDebugGun::OnAction(EntityId actorId, const ActionId& actionId, int activationMode, float value)
{
  if (actionId == "attack1")
  {     
    if (activationMode == eAAM_OnPress)
      Shoot(true);    
  }
  else if (actionId == "zoom")
  {
    if (activationMode == eAAM_OnPress)
      Shoot(false);
  }  
  else if (actionId == "firemode")
  {
    ++m_fireMode;

    if (m_fireMode == m_fireModes.size())
      m_fireMode = 0;
    
    //SGameObjectEvent evt("HUD_TextMessage", eGOEF_ToAll, IGameObjectSystem::InvalidExtensionID, (void*)m_fireModes[m_fireMode].c_str());
    //SendHUDEvent(evt);
  }
  else
    CWeapon::OnAction(actorId, actionId, activationMode, value);
}
示例#3
0
inline void DisparoRobot(double distancia){
    int disparosdistancia=0;
    Shoot(energiadisparo);
    Shoot(energiadisparo);
    Shoot(energiadisparo);
    if (distancia<6){
	Accelerate(2);
	disparosdistancia=5/distancia;
	while((disparosdistancia--)%10){
	    Shoot(energiadisparo);
	}
    }
    liberabloqueos();
}
示例#4
0
void ADuckTower::Tick(float DeltaSeconds)
{
	Super::Tick(DeltaSeconds);
	/*
	AActor *actor = GetAttachParentActor();
	FVector actor2 = UGameplayStatics::GetPlayerController(GetWorld(), 0)->GetControlledPawn()->GetActorLocation();
	FRotator newRotation = FRotationMatrix::MakeFromX(actor2 - actor->GetActorLocation()).Rotator();
	GetAttachParentActor()->SetActorRotation(newRotation);
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, actor->GetName());
	*//*
	FVector actor2 = UGameplayStatics::GetPlayerController(GetWorld(), 0)->GetControlledPawn()->GetActorLocation();
	FVector actor = GetAttachParentActor()->GetActorLocation();
	FVector Direction = actor - actor2;
	FRotator test = FRotationMatrix::MakeFromX(Direction).Rotator();
	GetAttachParentActor()->SetActorRotation(test);
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, actor2.ToString());
	*/
	//GetAttachParentActor()->SetActorLocation(FVector(0.0f, 0.0f, (float)testNumber));
	//testNumber += 1.f;
	APawn *player = UGameplayStatics::GetPlayerController(GetWorld(), 0)->GetControlledPawn();
	FVector actor2 = player->GetActorLocation(); //+ player->GetRootPrimitiveComponent()->GetPhysicsLinearVelocity() *DeltaSeconds * 10;
	FVector actor = GetActorLocation();
	FVector Direction = actor - actor2;
	FRotator test = FRotationMatrix::MakeFromX(Direction).Rotator();
	FRotator test2 = FRotator(1.0f, 0.0f, 0.0f);
	FRotator finalrot = FRotator(test.Quaternion() * test2.Quaternion());

	FVector vec2 = UGameplayStatics::GetPlayerController(GetWorld(), 0)->GetControlledPawn()->GetActorLocation();
	FVector vec = GetActorLocation();
	float distance = FVector::Dist(actor, actor2);

	//finalrot.Pitch -= 10 - distance / 10000 * 10;
	//SetActorRotation(finalrot);

	TArray<UStaticMeshComponent*> comps;
	GetComponents(comps);
	/*
	for (auto StaticMeshComponent : comps)
	{
	StaticMeshComponent->SetVisibility(true);
	StaticMeshComponent->SetWorldRotation(finalrot);
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, StaticMeshComponent->GetComponentRotation().ToString());
	}*/
	if (UGameplayStatics::GetPlayerController(GetWorld(), 0)->WasInputKeyJustPressed(EKeys::I))
	{

	}
	if (shootTimer <= 0.f)
	{


		Shoot(distance);
		shootTimer = 2.f;
	}
	else
		shootTimer -= DeltaSeconds;
	//GetAttachParentActor()->GetRootPrimitiveComponent()->AddImpulse(UGameplayStatics::GetPlayerController(GetWorld(), 0)->GetControlledPawn()->GetActorForwardVector());
	//GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, FString::FromInt(testNumber));
	//GetAttachParentActor()->SetActorRotation()
}
void GalaxianAttackingState::Update(Galaxian* a_galaxian, float a_fDeltaTime)
{
	m_deltaTimeMap[a_galaxian] += a_fDeltaTime;

	if(m_deltaTimeMap[a_galaxian] > 0.3f + randomNumber && abs((a_galaxian->GetPosition().x + a_galaxian->GetSprite()->GetWidth()/2) - m_pPlayer->GetPosition().x) < 5)
	{
		randomNumber = ((float)(rand()%3) / 10);
		m_deltaTimeMap[a_galaxian] = 0;
		Shoot(a_galaxian);
	}

	Vector2 target;
	if(a_galaxian->GetPositionInFormation().x >= m_formation->FORMATION_COLUMNS / 2)
	{
		target = Vector2(SCRWIDTH / 2 + cos(max((a_galaxian->GetPosition().y - 200) * PI/180, 0)) * SCRWIDTH / 2 - 80,a_galaxian->GetPosition().y + 100);
	}
	else
	{
		target = Vector2(SCRWIDTH / 2 + sin(max((a_galaxian->GetPosition().y - 200) * PI/180, 0)) * SCRWIDTH / 2 - 80,a_galaxian->GetPosition().y + 100);
	}
	Vector2 direction(target - a_galaxian->GetPosition());
	direction.Normalize();
	a_galaxian->Move(direction * a_fDeltaTime * 200);

	if(a_galaxian->GetPosition().y > SCRHEIGHT - 100)
	{
		a_galaxian->Move(0,250 * a_fDeltaTime);

		if(a_galaxian->GetPosition().y > SCRHEIGHT)
		{
			a_galaxian->SetPosition(Vector2(a_galaxian->GetPosition().x,-20));
			a_galaxian->ChangeState(GalaxianReturnToFormationState::getInstance());
		}
	}
}
示例#6
0
void Bullet::BulletInput(SDL_Event& e, Player& player)
{
	currentTime = SDL_GetTicks(); 
	if (e.type == SDL_KEYDOWN && e.key.repeat == 0) 
	{
		switch (e.key.keysym.sym)
		{
			case SDLK_SPACE: //add a bullet to the vector when space is pressed
				if(currentTime > lastTime + 300)
				{
					Shoot(player); 
					lastTime = currentTime; //time since last shot (reset cooldown)
					TheSoundManager::Instance()->PlaySound("1", 0);
				}
				break;
		}
	}
	else if(e.type == SDL_KEYUP && e.key.repeat == 0)
    {
        switch(e.key.keysym.sym)
        {
			case SDLK_SPACE:
				break; 
		}
	}
	
}
示例#7
0
//=========================================================
// HandleAnimEvent - catches the monster-specific messages
// that occur when tagged animation frames are played.
//
// Returns number of events handled, 0 if none.
//=========================================================
void CHAssassin :: HandleAnimEvent( MonsterEvent_t *pEvent )
{
	switch( pEvent->event )
	{
	case ASSASSIN_AE_SHOOT1:
		Shoot( );
		break;
	case ASSASSIN_AE_TOSS1:
		{
			UTIL_MakeVectors( pev->angles );
			CGrenade::ShootTimed( pev, pev->origin + gpGlobals->v_forward * 34 + Vector (0, 0, 32), m_vecTossVelocity, 2.0 );

			m_flNextGrenadeCheck = gpGlobals->time + 6;// wait six seconds before even looking again to see if a grenade can be thrown.
			m_fThrowGrenade = FALSE;
			// !!!LATER - when in a group, only try to throw grenade if ordered.
		}
		break;
	case ASSASSIN_AE_JUMP:
		{
			// ALERT( at_console, "jumping");
			UTIL_MakeAimVectors( pev->angles );
			pev->movetype = MOVETYPE_TOSS;
			pev->flags &= ~FL_ONGROUND;
			pev->velocity = m_vecJumpVelocity;
			m_flNextJump = gpGlobals->time + 3.0;
		}
		return;
	default:
		CBaseMonster::HandleAnimEvent( pEvent );
		break;
	}
}
示例#8
0
//------------------------------------------------------------------------
void CAutomatic::Update(float frameTime, uint32 frameId)
{
	CSingle::Update(frameTime, frameId);

	if(m_firing && CanFire(false))
		m_firing = Shoot(true);
}
示例#9
0
void Snake::HandleInput(sf::Event & E)
{
	//Implementacja interfejsu IControl. Zmienia stan wê¿a w zale¿noœci od rodzaju zda¿enia
	//przekazanego w argumencie, albo tworzy nowy pocisk zmierzaj¹cy do miejsca klikniêcia myszk¹.
	switch (E.type)
	{
	case sf::Event::KeyPressed:
		if (E.key.code == sf::Keyboard::W)
			TurnUp();
		else
		if (E.key.code == sf::Keyboard::S)
			TurnDown();
		else
		if (E.key.code == sf::Keyboard::D)
			TurnRight();
		else
		if (E.key.code == sf::Keyboard::A)
			TurnLeft();
		break;

	case sf::Event::MouseButtonPressed:
		if (E.mouseButton.button == sf::Mouse::Left)
			Shoot(E.mouseButton.x, E.mouseButton.y);
		break;
	default:
		break;
	}
}
示例#10
0
void Construct::ChooseTarget(Point2i mouse_pos)
{
  if (!EnoughAmmo())
    return;

  dst = mouse_pos;

  // Draw it so that GetSizeMax() returns the correct values.
  construct_spr->SetRotation_rad(angle);
  construct_spr->Draw(dst - construct_spr->GetSize() / 2);

  Point2i test_target = dst - construct_spr->GetSizeMax() / 2;
  Rectanglei rect(test_target, construct_spr->GetSizeMax());

  if (!GetWorld().ParanoiacRectIsInVacuum(rect))
    return;

  // Check collision with characters and other physical objects
  FOR_ALL_CHARACTERS(team, c) {
    if (c->GetTestRect().Intersect(rect))
      return;
  }

  FOR_ALL_OBJECTS(it) {
    PhysicalObj *obj = *it;
    if (obj->GetTestRect().Intersect(rect))
      return;
  }

  target_chosen = true;
  Shoot();
}
示例#11
0
//============================================================================
//移動
//============================================================================
void CEnemyCurve::Move()
{
	m_fSize.x = 64;
	m_fSize.y = 64;	
	
	Shoot();
	
	if( m_vPos.x < 0 )
	{
		this->SetRemoveFlag( true );

	}
	
	if( m_vPos.y > SCREEN_HEIGHT )
	{
		this->SetRemoveFlag( true );
	}

	
	m_RollAngle += DEG_TO_ANGLE( 2 );
	
	//m_Scroll --;


	m_vPos.x = Math::Cos( m_RollAngle ) * 300 + SCREEN_WIDTH;
	m_vPos.y = -Math::Sin( m_RollAngle ) * 305 + SCREEN_HEIGHT/ 2;
	
}
示例#12
0
inline void ParoDisparo(double angulo,double distancia){
    if ((i-tiempodisparo)>5 &  distancia<20 & angulo-angulodisparoanterior<0.1){
	Shoot(0.5);
    }
    tiempodisparo=i;
    angulodisparoanterior=angulo;
}
示例#13
0
void HandleKeys()
{
	if(!g_bGameOver)
	{
		if(GetAsyncKeyState('A') < 0)
		{
			g_pShipSprite -> OffsetPosition(-10, 0);
		}
		if(GetAsyncKeyState('D') < 0)
		{
			g_pShipSprite -> OffsetPosition(10, 0);
		}
		if(GetAsyncKeyState('W') < 0)
		{
			g_pShipSprite -> OffsetPosition(0, -10);
		}
		if(GetAsyncKeyState('S') < 0)
		{
			g_pShipSprite -> OffsetPosition(0, 10);
		}
		if((GetAsyncKeyState('K') < 0) && (++g_iShootDelay > 3))
		{
			Shoot();
			g_iShootDelay = 0;
		}
	}
}
示例#14
0
// Get player input, rotate the ship, fire shots, move active shots
void Play(void)
{
  int But = buttons();
  
  if( But & (1<<2) )
  {
    led(2,1);
    ShipAng = (ShipAng + RotSpeed) & 0x1fff;
  }
  else
    led(2,0);

  if( But & (1<<0) )
  {
    led(0,1);
    ShipAng = (ShipAng - RotSpeed) & 0x1fff;
  }
  else
    led(0,0);


  if( ShotTimer > 0 ) {
    ShotTimer--;
  }    

  if( But & ((1<<1) | (1<<4)) ) {
    Shoot();
  }

  MoveShots();
}
示例#15
0
文件: Canon.cpp 项目: Cyberra/Peggle
void Canon::Update()
{
	float dt = gTimer->GetDeltaTime();

	Rotate(dt);
	Shoot(dt);
	AddLife(dt);
}
示例#16
0
inline void EsquivoMina(double angulo){
    Shoot(0.02*energiadisparo);
    if (distancia<20 & ((angulo<90) | (angulo>270)) ){
	Accelerate(-0.5);
    }else{
	Accelerate(2);
    }
    Brake(1);
}
//---------------------------------------------------------
//---------------------------------------------------------
void CNPC_GroundTurret::GatherConditions()
{
	if( !IsEnabled() )
	{
		return;
	}

	if( !IsOpen() && !UTIL_FindClientInPVS( edict() ) )
	{
		return;
	}

	// Throw away old enemies so the turret can retire
	AIEnemiesIter_t iter;

	for( AI_EnemyInfo_t *pEMemory = GetEnemies()->GetFirst(&iter); pEMemory != NULL; pEMemory = GetEnemies()->GetNext(&iter) )
	{
		if( pEMemory->timeLastSeen < gpGlobals->curtime - GROUNDTURRET_RETIRE_TIME )
		{
			pEMemory->hEnemy = NULL;
		}
	}

	BaseClass::GatherConditions();

	if( GetEnemy() && HasCondition(COND_SEE_ENEMY) )
	{
		m_flTimeLastSawEnemy = gpGlobals->curtime;
	}
	else
	{
		if( gpGlobals->curtime - m_flTimeLastSawEnemy >= GROUNDTURRET_RETIRE_TIME )
		{
			m_OnAreaClear.FireOutput(this, this);
			m_flTimeLastSawEnemy = FLT_MAX;
			return;
		}
	}

	if( HasCondition( COND_SEE_ENEMY ) )
	{
		m_bSeeEnemy = true;
	}
	else
	{
		m_bSeeEnemy = false;
	}

	if( GetEnemy() && m_bSeeEnemy && IsEnabled() )
	{
		if( m_flTimeNextShoot < gpGlobals->curtime )
		{
			Shoot();
		}
	}
}
示例#18
0
// Updater //
void Player::UpdatePlayer(Fodder *fodder, int fodderLen, Sidewinder *winder, int winderLen) 
{
	if(alive) {
		Animate();
		Move(1280, 780);
		Shoot();
	}
	for(int i=0; i<bulletSize; i++) {
		bullet[i].BulletMove();
		bullet[i].ResetBullet(1280, 780);
	}
}
示例#19
0
文件: enemy.cpp 项目: Taka03/DogFight
//============================================================================
//移動
//============================================================================
void CEnemy::Move()
{
	Shoot();
	
	MovePatExec();
	
	#if defined( DEBUG ) | ( _DEBUG )
	
		//Renderer::IRender *pRender
	
	#endif
	
}
示例#20
0
void Player::CheckForUserInput()
{

	float_t keyLeft, keyRight, keyUp, keyDown, keyShoot;

	JsyInputGetInput(CGame::GetInstance()->GetJsyInputHandle(), JSY_INPUT_LEFT, &keyLeft);
	JsyInputGetInput(CGame::GetInstance()->GetJsyInputHandle(), JSY_INPUT_RIGHT, &keyRight);
	JsyInputGetInput(CGame::GetInstance()->GetJsyInputHandle(), JSY_INPUT_UP, &keyUp);
	JsyInputGetInput(CGame::GetInstance()->GetJsyInputHandle(), JSY_INPUT_DOWN, &keyDown);
	JsyInputGetInput(CGame::GetInstance()->GetJsyInputHandle(), JSY_INPUT_A, &keyShoot);

	// Check vertical movement
	if ((keyUp > 0.0f))
	{
		mVelocity.y = MOVE_FORCE;
	}
	else if ((keyDown > 0.0f))
	{
		mVelocity.y = -MOVE_FORCE;
	}
	else
	{
		mVelocity.y = 0.0f;
	}

	// Check horizontal movement
	if ((keyLeft > 0.0f))
	{
		mVelocity.x = -MOVE_FORCE;
		mIsFacingLeft = true;
	}
	else if ((keyRight > 0.0f))
	{
		mVelocity.x = MOVE_FORCE;
		mIsFacingLeft = false;
	}
	else
	{
		mVelocity.x = 0.0f;
	}

	// Check for firing missles
	if (mCanShoot && (keyShoot > 0.0f)) {
		mCanShoot = false;
		mShotTimer = 0;
		Shoot();
		if (mFireSFXId != 0) {
            JsyAudioPlaySound(CGame::GetInstance()->GetJsyAudioHandle(), mFireSFXId);
		}
	}
}
//------------------------------------------------------------------------
void CAutomatic::Update(float frameTime, uint32 frameId)
{
	BaseClass::Update(frameTime, frameId);

	if (m_firing && CanFire(false))
	{
		m_firing = Shoot(true, m_fireParams->fireparams.autoReload);

		if(!m_firing)
		{
			StopFire();
		}
	}
}
示例#22
0
void CAutomaticShotgun::Update(float frameTime, uint32 frameId)
{
    CShotgun::Update(frameTime, frameId);

    if (m_firing)
        {
            m_rapidFireCountdown -= frameTime;
            if (m_rapidFireCountdown < 0.0f && CanFire(true))
                {
                    bool shot = Shoot(true, true);
                    if (shot)
                        m_rapidFireCountdown += m_next_shot_dt;
                }
        }
}
示例#23
0
文件: Grid.cpp 项目: pinko64/mdr
void Grid::checkRow()
{
    if ( !stack.Row.empty() )
    {
        std::vector< int > ints;
        for ( int i = 0; i < 3; i++ )
        {
            ints.push_back( stack.Row[i] );
        }
        stack.Row.clear();
    Shoot( ints );

    }


}
示例#24
0
void Player::Control()
{
	SetSpeed(0,0);
	
	if(IsKeyDown('A'))
		SetSpeedX(-1.0f);
	if(IsKeyDown('D'))
		SetSpeedX(1.0f);
	if(IsKeyDown('W'))
		SetSpeedY(-1.0f);
	if(IsKeyDown('S'))
		SetSpeedY(1.0f);

	if(IsKeyDown('T'))
		Shoot();
}
示例#25
0
void Orc::update(float dt)
{
	if (_gameLogic->getGameState() == GameState::GAME)
	{
		Vec2 pos = this->getPosition();
		switch (_state)
		{
			case OrcState::MOVING:
			{
				Size visibleSize = Director::getInstance()->getVisibleSize();
				if (pos.y < visibleSize.height - _radius)
				{
					Shoot();
					CCDirector::getInstance()->getScheduler()->schedule(schedule_selector(Orc::Shoot), this, FIRING_RATE, false);
					_state = OrcState::SIEGE;
					_speed = Vec2(HORIZONTAL_SPEED, 0);
				}
			
				break;
			}
			case OrcState::SIEGE:
			{
				//just keep firing, the player will die... eventually... right?
				Size visibleSize = Director::getInstance()->getVisibleSize();
				if (pos.x < (visibleSize.width / 2 - visibleSize.width * SCREEN_BORDER_MARGIN / 2) ||
					pos.x >(visibleSize.width / 2 + visibleSize.width * SCREEN_BORDER_MARGIN / 2))
				{
					_speed = _speed*(-1);
				}
				break;
			}
			case OrcState::EXPLODING:
			{
				_time += dt;
				if (_time >= EXPLODING_TIME)
				{
					Die();
				}
				break;
			}
		}
		

		this->setPosition(pos + _speed);
	}
	
}
示例#26
0
void NPC::TakeAction(BasicAction action, int timeElapsedMs)
{
	//TODO: terrible code, consider using references
	switch (action)	{
	case eAttack: {
		StopMoving();
		StartAttack(); //TODO: might need to override
		break;
	}	
	case eMove: { //compiler mistook this for the Move() method..
		// reset speed to normal
		if (m_flags[eAffectedByGravity] && !m_flags[eJumping] && !m_flags[eFalling]) {
			m_speeds[eXSpeed] = m_speedX;
			m_speeds[eYSpeed] = m_speedY;
		}
		StartMoving(GetDirection());
		break;
	}	
	case eFlee: {
		// reset speed to normal
		if (m_flags[eAffectedByGravity] && !m_flags[eJumping] && !m_flags[eFalling]) {
			m_speeds[eXSpeed] = m_speedX;
			m_speeds[eYSpeed] = m_speedY;
		}
		//avoid colliding with the character
		//TODO: WHAT? This makes no sense (even before refactor)
		StartMoving(m_direction == eLeft ? eRight : eLeft);
		break;
	}	
	case eJump: {
		StartJump();
		break;
	}
	case eShoot: {
		Shoot(m_attackType);
		break;
	}
	default: {
		StopMoving();
		if (!m_flags[eAffectedByGravity]) {
			m_speeds[eXSpeed] = 0;
			m_speeds[eYSpeed] = 0;
		}
		break;
	}
	}
}
void EnemyRunShooting::Update()
{
	switch (m_ObjectState)
		{
		case STATE_ALIVE_MOVE:
			m_TimeChangeState += CGameTimeDx9::getInstance()->getElapsedGameTime().getMilliseconds();
			if(m_TimeChangeState > 2000)
			{
				m_TimeChangeState = 0;
				m_ObjectState = eObjectState::STATE_SHOOTING;
				isShoot = true;
			}
			break;
		case STATE_SHOOTING:
			if(m_Direction == eDirection::LEFT)
				this->m_DirectAttack = eDirectAttack::AD_LEFT;
			else
				this->m_DirectAttack = eDirectAttack::AD_RIGHT;
			if(isShoot == true)
			{
				Shoot();
				isShoot = false;
			}
			m_TimeChangeState += (int)CGameTimeDx9::getInstance()->getElapsedGameTime().getMilliseconds();
			if(m_TimeChangeState > 3000)
			{
				m_TimeChangeState = 0;
				m_ObjectState = eObjectState::STATE_ALIVE_MOVE;
			}
			break;
		case STATE_BEFORE_DEATH:
			m_TimeChangeState += CGameTimeDx9::getInstance()->getElapsedGameTime().getMilliseconds();
			if (m_TimeChangeState > 1500)
			{
				m_TimeChangeState = 0;
				m_ObjectState = eObjectState::STATE_DEATH;
			}
			break;
		case STATE_DEATH:
			if(this->m_Sprite != 0)
			this->Release();
			break;
		default:
			break;
		}
}
示例#28
0
// -----------------------------------
// MAIN TICK METHOD
void Turret::Tick(double deltaTime, DOUBLE2 heroPos)
{
	m_DeltaTime = deltaTime;
	m_HeroPos = heroPos;
	++m_TickCount;
	
	AnimationTick();

	// opening trigger
	if (abs(m_PosTurret.x - heroPos.x) < SHOOT_DISTANCE && m_BehaviourState == BehaviourState::CLOSED) Open();

	ChangeAngle();

	// shooting trigger
	if (abs(m_PosTurret.x - heroPos.x) < SHOOT_DISTANCE) Shoot();
	
}
void EnemyBigGunShooting::Update()
{
	switch (m_ObjectState)
		{
		case STATE_ALIVE_IDLE:
			m_TimeChangeState += (int)CGameTimeDx9::getInstance()->getElapsedGameTime().getMilliseconds();
			if(m_TimeChangeState > 3000)
			{
				m_TimeChangeState = 0;
				m_ObjectState = eObjectState::STATE_SHOOTING;
				m_isShoot = true;
			}
			break;
		case STATE_SHOOTING:
			if(m_isShoot == true)
			{
				Shoot();
				m_isShoot = false;
			}
			
			m_TimeChangeState += (int)CGameTimeDx9::getInstance()->getElapsedGameTime().getMilliseconds();
			if(m_TimeChangeState > 300)
			{
				m_TimeChangeState = 0;
				m_ObjectState = eObjectState::STATE_ALIVE_IDLE;
			}
			break;
		case STATE_BEFORE_DEATH:
			if (isDead)
			{
				m_TimeChangeState += CGameTimeDx9::getInstance()->getElapsedGameTime().getMilliseconds();
				if (m_TimeChangeState > 1500)
				{
					m_TimeChangeState = 0;
					m_ObjectState = eObjectState::STATE_DEATH;
				}
			}
			break;
		case STATE_DEATH:
			this->Release();
			break;
		default:
			break;
		}

}
示例#30
0
void BBMan::Update()
{
	Animation::Update();

	float dt = Engine::GetInstance()->GetTimer()->GetDeltaTime();
	currenTime += dt;
	
	Jump(flipped, dt);

	if (currenTime > 1.f)
	{
		Shoot(flipped); // works only once?? // Doesn't work anymore f**k that
		currenTime = 0;
	}

	Move(flipped, dt);

	SetPosition((int)currentX, (int)currentY);
}