本文整理汇总了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;
}
示例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);
}
示例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();
}
示例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()
}
示例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());
}
}
}
示例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;
}
}
}
示例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;
}
}
示例8: Shoot
//------------------------------------------------------------------------
void CAutomatic::Update(float frameTime, uint32 frameId)
{
CSingle::Update(frameTime, frameId);
if(m_firing && CanFire(false))
m_firing = Shoot(true);
}
示例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;
}
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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();
}
示例15: Rotate
void Canon::Update()
{
float dt = gTimer->GetDeltaTime();
Rotate(dt);
Shoot(dt);
AddLife(dt);
}