这篇教程C++ Fire函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中Fire函数的典型用法代码示例。如果您正苦于以下问题:C++ Fire函数的具体用法?C++ Fire怎么用?C++ Fire使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了Fire函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: StudioFrameAdvance//-----------------------------------------------------------------------------// Make sure our target is still valid, and if so, fire at it//-----------------------------------------------------------------------------void CObjectSentrygun::Attack(){ StudioFrameAdvance( ); if ( !FindTarget() ) { m_iState.Set( SENTRY_STATE_SEARCHING ); m_hEnemy = NULL; return; } // Track enemy Vector vecMid = EyePosition(); Vector vecMidEnemy = m_hEnemy->WorldSpaceCenter(); Vector vecDirToEnemy = vecMidEnemy - vecMid; QAngle angToTarget; VectorAngles( vecDirToEnemy, angToTarget ); angToTarget.y = UTIL_AngleMod( angToTarget.y ); if (angToTarget.x < -180) angToTarget.x += 360; if (angToTarget.x > 180) angToTarget.x -= 360; // now all numbers should be in [1...360] // pin to turret limitations to [-50...50] if (angToTarget.x > 50) angToTarget.x = 50; else if (angToTarget.x < -50) angToTarget.x = -50; m_vecGoalAngles.y = angToTarget.y; m_vecGoalAngles.x = angToTarget.x; MoveTurret(); // Fire on the target if it's within 10 units of being aimed right at it if ( m_flNextAttack <= gpGlobals->curtime && (m_vecGoalAngles - m_vecCurAngles).Length() <= 10 ) { Fire(); if ( m_iUpgradeLevel == 1 ) { // Level 1 sentries fire slower m_flNextAttack = gpGlobals->curtime + 0.2; } else { m_flNextAttack = gpGlobals->curtime + 0.1; } } else { // SetSentryAnim( TFTURRET_ANIM_SPIN ); }}
开发者ID:MrBoomer568,项目名称:TF2Classic,代码行数:59,
示例2: Firevoid CBaseMelee::SecondaryAttack( void ){ Fire();#ifndef CLIENT_DLL MESSAGE_BEGIN( MSG_ONE, gmsgHintbox, NULL, m_pPlayer->pev ); WRITE_SHORT(HINTBOX_MELEE2); MESSAGE_END();#endif}
开发者ID:BackupTheBerlios,项目名称:battlegrounds-svn,代码行数:10,
示例3: AngleVectors//-----------------------------------------------------------------------------// Purpose: //-----------------------------------------------------------------------------void CFuncTankMortar::ShootGun( void ){ Vector forward; AngleVectors( GetLocalAngles(), &forward ); UpdateMatrix(); forward = m_parentMatrix.ApplyRotation( forward ); // use cached firing state Fire( 1, WorldBarrelPosition(), forward, m_pAttacker ); }
开发者ID:AgentAgrimar,项目名称:source-sdk-trilogy,代码行数:13,
示例4: UTIL_MakeVectors//=========================================================// StartFire- since all of this code has to run and then // call Fire(), it was easier at this point to rip it out // of weaponidle() and make its own function then to try to// merge this into Fire(), which has some identical variable names //=========================================================void CGauss::StartFire( void ){ float flDamage; UTIL_MakeVectors( m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle ); Vector vecAiming = gpGlobals->v_forward; Vector vecSrc = m_pPlayer->GetGunPosition( ); // + gpGlobals->v_up * -8 + gpGlobals->v_right * 8; if ( gpGlobals->time - m_pPlayer->m_flStartCharge > GetFullChargeTime() ) { flDamage = 200; } else { flDamage = 200 * (( gpGlobals->time - m_pPlayer->m_flStartCharge) / GetFullChargeTime() ); } if ( m_fPrimaryFire ) { // fixed damage on primary attack#ifdef CLIENT_DLL flDamage = 20;#else flDamage = gSkillData.plrDmgGauss;#endif } if (m_fInAttack != 3) { //ALERT ( at_console, "Time:%f Damage:%f/n", gpGlobals->time - m_pPlayer->m_flStartCharge, flDamage );#ifndef CLIENT_DLL float flZVel = m_pPlayer->pev->velocity.z; if ( !m_fPrimaryFire ) { m_pPlayer->pev->velocity = m_pPlayer->pev->velocity - gpGlobals->v_forward * flDamage * 5; } if ( !g_pGameRules->IsMultiplayer() ) { // in deathmatch, gauss can pop you up into the air. Not in single play. m_pPlayer->pev->velocity.z = flZVel; }#endif // player "shoot" animation m_pPlayer->SetAnimation( PLAYER_ATTACK1 ); } // time until aftershock 'static discharge' sound m_pPlayer->m_flPlayAftershock = gpGlobals->time + UTIL_SharedRandomFloat( m_pPlayer->random_seed, 0.3, 0.8 ); Fire( vecSrc, vecAiming, flDamage );}
开发者ID:Solexid,项目名称:halflife,代码行数:61,
示例5: BP_PreFire// Pre Firevoid AWeapon::PreFire(){ // BP Pre Fire BP_PreFire(); if (!ThePlayer)return; // If player stopped shooting stop event if (!bShooting ) { ThePlayer->GetWorldTimerManager().ClearTimer(PreFireTimeHandle); return; } // Currently Equiping this weapon, delay a bit if (ThePlayer->IsAnimState(EAnimState::Equip)) { // try after a small delay FTimerHandle MyHandle; ThePlayer->GetWorldTimerManager().SetTimer(MyHandle, this, &AWeapon::PreFire, 0.2, false); return; } // Wrong Weapon or Player Anim State if (!CanShoot())return; // Ammo Check if (!MainFire.CanFire()) { // BP No Ammo BP_NoAmmo(); // if have ammo, start reloading if (CanReload())ReloadWeaponStart(); return; } // The real fire event Fire(); // Use Ammo if (bUseAmmo)UseMainFireAmmo(); // Set Player Anim State ThePlayer->ServerSetAnimID(EAnimState::Fire); // Decrease move speed when shooting ThePlayer->ResetMoveSpeed(); /// Stop Fire Anim FTimerHandle MyHandle; ThePlayer->GetWorldTimerManager().SetTimer(MyHandle, this, &AWeapon::StopFireAnim, 0.1, false);}
开发者ID:MatrIsCool,项目名称:Rade,代码行数:56,
示例6: AttackTimevoid SlimeKingMiddle::MoodAttack(float dt){ if (timer == kTimerUp) { timer = AttackTime(); Animate("Stay", myEnum::kAction::kActionAttack); // fire a ball auto sp = this->getPosition(); sp.y -= this->getContentSize().height; auto dp1 = Vec2(sp.x - CCRANDOM_MINUS1_1(), sp.y - 1); auto dp2 = Vec2(sp.x - CCRANDOM_MINUS1_1(), sp.y - 1); Fire(layer, sp, dp1); Fire(layer, sp, dp2); } else if (timer <= 0.0f) { ChooseMood(); }}
开发者ID:ilhaeYe,项目名称:MB,代码行数:20,
示例7: SetNewFireTimevoid cBoss::SpecificLogic(const cMap &map) { if (--fireTime <= 0) { SetNewFireTime(); Fire(); } if (--directionTime <= 0) { SetNewDirectionTime(); SetNewDirection(); } Move(map, direction, sceneX, sceneY);}
开发者ID:afj176,项目名称:zelda,代码行数:11,
示例8: Firevoid SpreadWeapon::Update(Vector2D location,Vector2D target){ if(firing) { if(shotTimer.get_ticks() >= fireRate) { Fire(location, target); shotTimer.start(); } }}
开发者ID:Chocken,项目名称:shmup,代码行数:11,
示例9: Firevoid cgAircraftWeapon::Update( float fDeltaTime ){ if (!m_pkConfig) return ; m_fCD += fDeltaTime; if (m_fCD >= m_pkConfig->fFireCD) { m_fCD -= m_pkConfig->fFireCD; Fire(); }}
开发者ID:cgcoolgame,项目名称:cg,代码行数:12,
示例10: vec3void clSpaceShip::Update( float dt ){ iActor::Update( dt );// printf("vv = %f/n", g_ScreenJoystick->GetAxisValue(0)); if ( g_Game->IsKeyPressed( SDLK_LEFT ) ) { m_Angle += dt; } if ( g_Game->IsKeyPressed( SDLK_RIGHT ) ) { m_Angle -= dt; } bool Accel = g_Game->IsKeyPressed( SDLK_UP ); bool Decel = g_Game->IsKeyPressed( SDLK_DOWN ); m_Accel = vec3( 0.0f ); if ( Accel ) { m_Accel = GetDirection(); } if ( Decel ) { m_Accel += -GetDirection(); } if ( g_Game->IsKeyPressed( SDLK_SPACE ) ) { Fire(); } m_Pos = g_Game->ClampToLevel( m_Pos ); m_Vel *= 0.99f; const float MaxVel = 1.1f; if ( m_Vel.Length() > MaxVel ) { m_Vel = ( m_Vel / m_Vel.Length() ) * MaxVel; } m_FireTime -= dt; if ( m_FireTime < 0 ) { m_FireTime = 0.0f; } mat4 ScaleFix = mat4::GetScaleMatrix( vec3( 0.1f ) ); mat4 RotFix = mat4::GetRotateMatrixAxis( 90.0f * Math::DTOR, vec3( 0, 0, 1 ) ); mat4 Pos = mat4::GetTranslateMatrix( m_Pos ); mat4 Rot = mat4::GetRotateMatrixAxis( m_Angle, vec3( 0, 0, 1 ) ); if ( m_Node ) { m_Node->SetLocalTransform( ScaleFix * RotFix * Rot * Pos ); }}
开发者ID:adarash,项目名称:Mastering-Android-NDK,代码行数:53,
示例11: Execute void Execute() { auto projectile = mWeapon->GetProjectile()->Clone(); projectile->SetPosition(mPosition); projectile->SetVelocity(sf::Vector2f(projectile->GetSpeed(), 0.0f)); projectile->SetRotation(0.0f); projectile->SetZOrder(50); projectile->SetCurrentAimpoint(mCurrAim); projectile->SetFinalAimpoint(mFinalAim); projectile->Fire(); mDrawNode->Add(projectile); }
开发者ID:MysteriousMilk,项目名称:ProjectOrion,代码行数:12,
示例12: CalculateStreamTime//----------------------------------------------------------------------------// // ROUTINE: CAIHumanStrategyShootStream::UpdateAiming()// // PURPOSE: // //----------------------------------------------------------------------------/*virtual*/ void CAIHumanStrategyShootStream::UpdateAiming(HOBJECT hTarget){ if ( m_flStreamTime < g_pLTServer->GetTime() ) { // Don't calculate new stream time until finished firing animation. if( !GetAnimationContext()->IsLocked() ) { CalculateStreamTime(); } Aim(); } else { // We're done waiting, fire if we're at a reasonable angle if ( m_bIgnoreFOV ) { Fire(); } else { LTVector vTargetPos; g_pLTServer->GetObjectPos(hTarget, &vTargetPos); LTVector vDir = vTargetPos - GetAI()->GetPosition(); vDir.y = 0.0f; vDir.Normalize(); if ( vDir.Dot(GetAI()->GetTorsoForward()) < 0.70f ) { Aim(); } else { Fire(); } } }}
开发者ID:rickyharis39,项目名称:nolf2,代码行数:47,
示例13: fabsvoid CASW_Sentry_Top::CheckFiring(){ if ( gpGlobals->curtime > m_fNextFireTime && HasAmmo() && ( m_bHasHysteresis || m_hEnemy.Get() ) ) { float flDist = fabs(m_fGoalYaw - m_fCurrentYaw); flDist = fsel( flDist - 180, 360 - flDist, flDist ); if ( (flDist < ASW_SENTRY_FIRE_ANGLE_THRESHOLD) || ( m_bHasHysteresis && !m_hEnemy ) ) { Fire(); } }}
开发者ID:Nightgunner5,项目名称:Jastian-Summer,代码行数:13,
示例14: GetPositionvoid RPG_Projectile::Fire(hkvVec3 position, VisBaseEntity_cl* target, bool trackTarget, float speed){ if(trackTarget) { m_targetToTrack = target; } hkvVec3 directionToTarget = target->GetPosition() - GetPosition(); if(directionToTarget.normalizeIfNotZero() == HKV_SUCCESS) { Fire(position, directionToTarget, speed); }}
开发者ID:Arpit007,项目名称:projectanarchy,代码行数:13,
示例15: timerEventvoid ODeferrer :: timerEvent (QTimerEvent *pQTimerEvent ){ killTimer(timerid); if ( parent() ) setParent(NULL); Fire(); delete this;}
开发者ID:BackupTheBerlios,项目名称:openaqua-svn,代码行数:13,
示例16: GetWorldvoid ABaseWeapon::HandleFiring(){ const float GameTime = GetWorld()->GetTimeSeconds(); if (LastFireTime > 0 && WeaponConfig.TimeBetweenShots > 0 && LastFireTime + WeaponConfig.TimeBetweenShots > GameTime) { GetWorldTimerManager().SetTimer(time_handler, this, &ABaseWeapon::Fire, LastFireTime + WeaponConfig.TimeBetweenShots - GameTime, false); } else { Fire(); }}
开发者ID:ZerosGames,项目名称:FightKillWin,代码行数:13,
示例17: Fire////// TRANSITIONNODE DEFINITIONS //////void TransitionNode::UpdateKey(unsigned int n){ _fireCounter++; // how do we erase one 1? it has to omit any value present in both. // bitwise XOR to update key state _firekey ^= n; // if all 1's are gone if((_firekey&0xffffffff)==0) { _isActivated = true; Fire(); }}
开发者ID:stumposs,项目名称:DP,代码行数:16,
示例18: FireKylin::Factor* Kylin::ActionDispatcher::Fire( KUINT uGID,KUINT uTarget ){ Kylin::Entity* pEnt = KylinRoot::GetSingletonPtr()->GetEntity(uTarget); if (pEnt) { Factor* pFactor = Fire(uGID); SAFE_CALL(pFactor,SetTarget(uTarget)); return pFactor; } return NULL;}
开发者ID:dzw,项目名称:kylin001v,代码行数:13,
示例19: Reload/*void Weapon::FixedUpdate(float timeStep){ Actor::FixedUpdate(timeStep); //something //SetLeftHandOffset();}*/void Weapon::Update(Controls& ctrl, float timeStep){ lefthand_target_=node_->GetWorldTransform()*lefthand_off_; //node_->SetPosition(Vector3(0.2f, 0.2f, 0.2f));//objectNode //this is called from the pawn controlling it, fron thier fixed update, like a state if(reloading_) Reload(timeStep); if (ctrl.IsDown(CTRL_FIRE)) Fire(timeStep); else ReleaseFire();}
开发者ID:ghidra,项目名称:urho_framework,代码行数:19,
示例20: GetOverlappingActorsvoid ALightningStorm::Tick(float DeltaTime){ Super::Tick(DeltaTime); TArray<AActor*> OverlappingActors; GetOverlappingActors(OverlappingActors, ASwoim::StaticClass()); int FireCounter = 0; TArray<ASwoim*> HitSwoimers; for (auto& first : OverlappingActors) { for (auto& second : OverlappingActors) { float d = FVector::Dist(first->GetActorLocation(), second->GetActorLocation()); if (d > 0 && d < ArcDistance) { HitSwoimers.Add(Cast<ASwoim>(second)); } } } if (HitSwoimers.Num() > 1) { int32 CurInt = FMath::RandRange(0, HitSwoimers.Num() - 1); int32 NextInt = FMath::RandRange(0, HitSwoimers.Num() - 1); for (int i = LightiningsArray.Num(); i < FMath::Min(HitSwoimers.Num(), NumOfLights); i++) { LightiningsArray.Add(Fire(HitSwoimers[CurInt], HitSwoimers[NextInt])); CurInt = NextInt; NextInt = FMath::RandRange(0, HitSwoimers.Num() - 1); } } UE_LOG(LogTemp, Warning, TEXT("LightiningsArray %d"), LightiningsArray.Num()); bool IsCompeleted = true; for (auto& Lightining : LightiningsArray) { if (!Lightining->HasCompleted()) { IsCompeleted = false; } } if (IsCompeleted) { LightiningsArray.Empty(); }}
开发者ID:TeAhTimEh,项目名称:Swoimz,代码行数:51,
示例21: Firevoid SpikerComponent::HandleDamage(float amount, gentity_t *source, Util::optional<Vec3> location, Util::optional<Vec3> direction, int flags, meansOfDeath_t meansOfDeath) { if (!GetAlienBuildableComponent().GetBuildableComponent().Active()) { return; } // Shoot if there is a viable target. if (lastExpectedDamage > 0.0f) { logger.Verbose("Spiker #%i was hurt while an enemy is close enough to also get hurt, so " "go eye for an eye.", entity.oldEnt->s.number); Fire(); }}
开发者ID:t4im,项目名称:Unvanquished,代码行数:14,
示例22: MojLogTracevoid MojoExclusiveTrigger::ProcessResponse(const MojObject& response, MojErr err){ MojLogTrace(s_log); /* Subscription guarantees any errors received are from the subscribing * Service. Transient bus errors are handled automatically. * * XXX have an option to disable auto-resubscribe */ if (err) { MojLogInfo(s_log, _T("[Activity %llu] Trigger call /"%s/" failed"), m_activity.lock()->GetId(), m_subscription->GetURL().GetURL().data()); m_response = response; Fire(); } else if (m_matcher->Match(response)) { MojLogInfo(s_log, _T("[Activity %llu] Trigger call /"%s/" fired!"), m_activity.lock()->GetId(), m_subscription->GetURL().GetURL().data()); m_response = response; Fire(); }}
开发者ID:jukkahonkela-owo,项目名称:activitymanager,代码行数:23,
示例23: Tickvoid ATankAIController::Tick(float DeltaSeconds){ Super::Tick(DeltaSeconds); ATank* PlayerTank = Cast<ATank>(GetWorld()->GetFirstPlayerController()->GetPawn()); auto ControlledTank = Cast<ATank>(GetPawn()); if (PlayerTank) { ControlledTank->AimAt(PlayerTank->GetActorLocation()); } ControlledTank->Fire();}
开发者ID:DanielsUnreal,项目名称:Section_04_BattleTank,代码行数:14,
示例24: CheckKeyvoid GameManager::AI(){ CheckKey(); if (GameStart() && !GamePause() && !GameOver()) { Produce(_T("Enemy")); Produce(_T("Cloud")); Produce(_T("Angela")); CheckCollision(); MoveIt(); Fire(); TrashRecycle(); }}
开发者ID:VivienCheng,项目名称:SkyPlane,代码行数:14,
示例25: switchvoid NumberEntry::OnPress(BUTTON_TYPE button){ switch (button) { default: Control::OnPress(button); break; case btRightTop: m_items[m_index].value++; if (m_items[m_index].value > m_items[m_index].max) m_items[m_index].value = m_items[m_index].min; Container()->Refresh(this); Fire((void*)m_index); break; case btRightCentre: { int find = m_index; do { find++; if (find >= m_count) find = 0; if (find == m_index) // Sanity check break; } while (m_items[find].type != tDigit); m_index = find; Container()->Refresh(this); } break; case btRightBottom: m_items[m_index].value--; if (m_items[m_index].value < m_items[m_index].min) m_items[m_index].value = m_items[m_index].max; Container()->Refresh(this); Fire((void*)m_index); break; }}
开发者ID:RAFACG,项目名称:IndependentlySmartWatch,代码行数:37,
示例26: Updatevoid Player::Update(float a_dt){ m_fTimer += a_dt; // Why are we incrementing m_fTimer? To set a bullet fire rate if (IsKeyDown('A')) m_x -= m_speed * a_dt; if (IsKeyDown('D')) m_x += m_speed * a_dt; if (IsKeyDown('W')) m_y -= m_speed * a_dt; if (IsKeyDown('S')) m_y += m_speed * a_dt; if (IsKeyDown(' ')) Fire(); // Check tos ee if we hit a boundary, this is concise- but if you expand // it a little bit, it doesn't look much different from what you have done already if (m_x < 0 + (m_pad + m_w2)) m_x = 0 + (m_pad + m_w2); if (m_x > g_w - (m_pad + m_w2)) m_x = g_w - (m_pad + m_w2);}
开发者ID:DylanGuidry95,项目名称:Assessment1Project,代码行数:15,
示例27: Firevoid Unit::Update(float fT){ if(m_eUnitStatus==enUnitStatusFight) { if(m_nFireCd<0) { m_nFireCd = m_unitData.nFireCD; Fire(); } else { m_nFireCd -= 1 + CCRANDOM_0_1()*2; } }}
开发者ID:cjlaaa,项目名称:WarDemo,代码行数:15,
示例28: Fire//-----------------------------------------------------------------------------// Purpose: Start of firing sequence. By default, just fire now.// Input : &barrelEnd - // &forward - // *pAttacker - //-----------------------------------------------------------------------------void CFuncTank::FiringSequence( const Vector &barrelEnd, const Vector &forward, CBaseEntity *pAttacker ){ if ( m_fireLast != 0 ) { int bulletCount = (gpGlobals->curtime - m_fireLast) * m_fireRate; if ( bulletCount > 0 ) { Fire( bulletCount, barrelEnd, forward, pAttacker ); m_fireLast = gpGlobals->curtime; } } else { m_fireLast = gpGlobals->curtime; }}
开发者ID:AgentAgrimar,项目名称:source-sdk-trilogy,代码行数:23,
示例29: Fire// -----------------------------------------------------------------------------// CImageCapture::CaptureL// -----------------------------------------------------------------------------//void CImageCapture::CaptureL(const TDesC& aName,const TDesC& aXmlFileName, TUid aAppUid){ iFileName.Copy(aName); iXmlFileName.Copy(aXmlFileName); iAppUid = aAppUid; if(AknLayoutUtils::PenEnabled() && !(aAppUid.iUid ) ) { User::After(KWait1); } if(iAppUid.iUid) Fire(EWaiting); else DoCaptureL(); }
开发者ID:fedor4ever,项目名称:testfw,代码行数:21,
示例30: AttackTimevoid Guard::MoodAttack(float dt){ if (timer == kTimerUp) { timer = AttackTime(); // fire a ball auto sp = this->getPosition(); sp.y -= this->getContentSize().height; auto dp1 = Vec2(sp.x - CCRANDOM_MINUS1_1(), sp.y - 1); Fire(layer, sp, dp1); } else if (timer <= 0.0f) { ChooseMood(); }}
开发者ID:ilhaeYe,项目名称:MB,代码行数:17,
注:本文中的Fire函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FireBullets函数代码示例 C++ FinishCommand函数代码示例 |