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


C++ Shoot函数代码示例

本文整理汇总了C++中Shoot函数的典型用法代码示例。如果您正苦于以下问题:C++ Shoot函数的具体用法?C++ Shoot怎么用?C++ Shoot使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: Shoot

//------------------------------------------------------------------------
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;
}
开发者ID:Adi0927,项目名称:alecmercer-origins,代码行数:36,代码来源:Burst.cpp

示例2: Shoot

//------------------------------------------------------------------------
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);
}
开发者ID:MrHankey,项目名称:destructionderby,代码行数:26,代码来源:DebugGun.cpp

示例3: DisparoRobot

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();
}
开发者ID:brainsqueezer,项目名称:realtimebattle,代码行数:14,代码来源:sauron.c

示例4: GetAttachParentActor

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()
}
开发者ID:SlooBo,项目名称:RalliaPerkele,代码行数:60,代码来源:DuckTower.cpp

示例5: Shoot

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());
		}
	}
}
开发者ID:EricPolman,项目名称:Galaxian,代码行数:35,代码来源:GalaxianAttackingState.cpp

示例6: SDL_GetTicks

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; 
		}
	}
	
}
开发者ID:dvellucci,项目名称:2D-Space-Shooter,代码行数:27,代码来源:Bullet.cpp

示例7: HandleAnimEvent

//=========================================================
// 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;
	}
}
开发者ID:6779660,项目名称:halflife,代码行数:38,代码来源:hassassin.cpp

示例8: Shoot

//------------------------------------------------------------------------
void CAutomatic::Update(float frameTime, uint32 frameId)
{
	CSingle::Update(frameTime, frameId);

	if(m_firing && CanFire(false))
		m_firing = Shoot(true);
}
开发者ID:super-nova,项目名称:NovaRepo,代码行数:8,代码来源:Automatic.cpp

示例9: switch

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;
	}
}
开发者ID:MaciejBlady,项目名称:HumbleShowcase,代码行数:28,代码来源:Snake.cpp

示例10: rect

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();
}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:32,代码来源:construct.cpp

示例11: Shoot

//============================================================================
//移動
//============================================================================
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;
	
}
开发者ID:Taka03,项目名称:DogFight,代码行数:31,代码来源:EnemyCurve.cpp

示例12: ParoDisparo

inline void ParoDisparo(double angulo,double distancia){
    if ((i-tiempodisparo)>5 &  distancia<20 & angulo-angulodisparoanterior<0.1){
	Shoot(0.5);
    }
    tiempodisparo=i;
    angulodisparoanterior=angulo;
}
开发者ID:brainsqueezer,项目名称:realtimebattle,代码行数:7,代码来源:sauron.c

示例13: HandleKeys

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;
		}
	}
}
开发者ID:giloppo,项目名称:MeteorDefense,代码行数:27,代码来源:MeteorDefense.cpp

示例14: Play

// 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();
}
开发者ID:MatzElectronics,项目名称:Simple-Libraries,代码行数:32,代码来源:Shooter.c

示例15: Rotate

void Canon::Update()
{
	float dt = gTimer->GetDeltaTime();

	Rotate(dt);
	Shoot(dt);
	AddLife(dt);
}
开发者ID:Cyberra,项目名称:Peggle,代码行数:8,代码来源:Canon.cpp


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