当前位置: 首页 > news >正文

linux下网站开发深圳教育平台网站建设

linux下网站开发,深圳教育平台网站建设,用word可以做网站吗,太原汽车网站建设之前一直没搞懂按下鼠标左键开火之后#xff0c;代码的逻辑是怎么走的#xff0c;今天看懂了之前没看懂的部分#xff0c;进了一步 ShooterCharacter.cpp void AShooterCharacter::OnStartFire() {AShooterPlayerController* MyPC CastAShooterPlayerController(Co…之前一直没搞懂按下鼠标左键开火之后代码的逻辑是怎么走的今天看懂了之前没看懂的部分进了一步 ShooterCharacter.cpp void AShooterCharacter::OnStartFire() {AShooterPlayerController* MyPC CastAShooterPlayerController(Controller);if (MyPC MyPC-IsGameInputAllowed()){if (IsRunning()){SetRunning(false, false);}StartWeaponFire();} } void AShooterCharacter::StartWeaponFire() {if (!bWantsToFire){bWantsToFire true;if (CurrentWeapon){CurrentWeapon-StartFire();}} } ShooterWeapon.cpp其中RoleROLE_Authority表示该程序运行在服务器。如果是客户端则将调用ServerStartFire来调用服务端的StartFire方法。这是多人游戏中的机制 void AShooterWeapon::StartFire() {if (Role ROLE_Authority){ServerStartFire();}if (!bWantsToFire){bWantsToFire true;DetermineWeaponState();} }   void AShooterWeapon::DetermineWeaponState() {EWeaponState::Type NewState EWeaponState::Idle;if (bIsEquipped){if( bPendingReload ){if( CanReload() false ){NewState CurrentState;}else{NewState EWeaponState::Reloading;}} else if ( (bPendingReload false ) ( bWantsToFire true ) ( CanFire() true )){NewState EWeaponState::Firing;}}else if (bPendingEquip){NewState EWeaponState::Equipping;}SetWeaponState(NewState); }   void AShooterWeapon::SetWeaponState(EWeaponState::Type NewState) {const EWeaponState::Type PrevState CurrentState;if (PrevState EWeaponState::Firing NewState ! EWeaponState::Firing){OnBurstFinished();}CurrentState NewState;if (PrevState ! EWeaponState::Firing NewState EWeaponState::Firing){OnBurstStarted();} }   void AShooterWeapon::OnBurstStarted() {// start firing, can be delayed to satisfy TimeBetweenShotsconst float GameTime GetWorld()-GetTimeSeconds();if (LastFireTime 0 WeaponConfig.TimeBetweenShots 0.0f LastFireTime WeaponConfig.TimeBetweenShots GameTime){GetWorldTimerManager().SetTimer(TimerHandle_HandleFiring, this, AShooterWeapon::HandleFiring, LastFireTime WeaponConfig.TimeBetweenShots - GameTime, false);}else{HandleFiring();} } 下面标红的FireWeapon这个函数实际上在AShooterWeapon中是一个虚函数并且没有实现实现是放在了子类中。它有两个子类分别是AShooterWeapon_Instant弹道类和AShooterWeapon_Projectile投掷类 我觉得肯定真正使用到的类就是这两个子类所以包括之前的这个流程实际上都是子类中的只不过是从父类中继承而已当然我此时此刻没有去深究那些方法的可见性修饰符是否会被继承这些细节问题我先暂时这么认为吧 void AShooterWeapon::HandleFiring() {if ((CurrentAmmoInClip 0 || HasInfiniteClip() || HasInfiniteAmmo()) CanFire()){if (GetNetMode() ! NM_DedicatedServer){SimulateWeaponFire();}if (MyPawn MyPawn-IsLocallyControlled()){FireWeapon();UseAmmo();// update firing FX on remote clients if function was called on serverBurstCounter;}}else if (CanReload()){StartReload();}else if (MyPawn MyPawn-IsLocallyControlled()){if (GetCurrentAmmo() 0 !bRefiring){PlayWeaponSound(OutOfAmmoSound);AShooterPlayerController* MyPC CastAShooterPlayerController(MyPawn-Controller);AShooterHUD* MyHUD MyPC ? CastAShooterHUD(MyPC-GetHUD()) : NULL;if (MyHUD){MyHUD-NotifyOutOfAmmo();}}// stop weapon fire FX, but stay in Firing stateif (BurstCounter 0){OnBurstFinished();}}if (MyPawn MyPawn-IsLocallyControlled()){// local client will notify serverif (Role ROLE_Authority){ServerHandleFiring();}// reload after firing last roundif (CurrentAmmoInClip 0 CanReload()){StartReload();}// setup refire timerbRefiring (CurrentState EWeaponState::Firing WeaponConfig.TimeBetweenShots 0.0f);if (bRefiring){GetWorldTimerManager().SetTimer(TimerHandle_HandleFiring, this, AShooterWeapon::HandleFiring, WeaponConfig.TimeBetweenShots, false);}}LastFireTime GetWorld()-GetTimeSeconds(); }   void AShooterWeapon_Instant::FireWeapon() {const int32 RandomSeed FMath::Rand();FRandomStream WeaponRandomStream(RandomSeed);const float CurrentSpread GetCurrentSpread();const float ConeHalfAngle FMath::DegreesToRadians(CurrentSpread * 0.5f);//获取AShooterPlayerController的rotation的单位向量const FVector AimDir GetAdjustedAim();const FVector StartTrace GetCameraDamageStartLocation(AimDir);const FVector ShootDir WeaponRandomStream.VRandCone(AimDir, ConeHalfAngle, ConeHalfAngle);const FVector EndTrace StartTrace ShootDir * InstantConfig.WeaponRange;const FHitResult Impact WeaponTrace(StartTrace, EndTrace);ProcessInstantHit(Impact, StartTrace, ShootDir, RandomSeed, CurrentSpread);CurrentFiringSpread FMath::Min(InstantConfig.FiringSpreadMax, CurrentFiringSpread InstantConfig.FiringSpreadIncrement); }  转载于:https://www.cnblogs.com/heben/p/8046726.html
http://www.yutouwan.com/news/40183/

相关文章:

  • 公司网站彩页怎么做品牌科技公司排名
  • 济南建设网站 概况淘宝客聚惠购的网站怎么做
  • 网站建设相关小论文电商网站建设市场分析
  • 广告制作公司网站建设模板河北智能网站建设
  • 网站建设考试题目免费软件网站有哪些
  • 个人备案之后用于商城网站淮北做网站电话
  • 福州设计网站建设网站建设采购
  • 网站备案被注销怎么办十张优秀海报设计欣赏
  • 福州网站建设案例包装设计网页
  • wordpress图片整站com域名查询
  • 企业网站找私人做什哈尔滨网站设计培训班
  • 常用的oa系统办公软件越秀seo搜索引擎优化
  • 网站建设为什么要全款色粉引流推广平台
  • 东莞响应式网站哪家好个人网站不备案会怎么样
  • 网站后台文本编辑器网线插座接法
  • 怎么自己创建一个网站代码安卓手机下载app的软件
  • 企业网站建设飞沐徐州app定制开发
  • 网站代码的重点内容是什么英文专业的网站建设
  • 推广网站排名企业网站建设参考文献
  • 微信官网网站模板下载安装营销型网站的建设要求都有什么
  • 大连建设厅网站网站素材下载
  • 电子商务网站建设实训作业有什么网站用名字做图片大全
  • app网站开发框架wordpress在中国很慢
  • 南昌建站国外社交网站建设
  • 做网站42类商标怎么选小类网络平台 策划方案
  • 工业和信息部网站备案十堰商城网站建设
  • 网站建设培训方案母婴用品网站建设规划
  • 桂林网站排名jsp网站开发介绍
  • 做网站看网页效果石油化工工程建设人才招聘网站
  • wordpress 文章内容分页网站建设优化服务价位