/// <summary> /// 开关镜 /// </summary> public void SwitchGlass() { if (!isHold) {//开镜 isHold = true; M_GunViewBase.EnterHoldPose(weapenType, 0.2f, 40); BattleSys.Instance.Aim(true); } else {//关镜 isHold = false; M_GunViewBase.ExitHoldPose(weapenType, 0.2f, 60); BattleSys.Instance.Aim(false); } }
public virtual void ReloadBullet() { if (CurrentFrontBullet < weapenFrontBullet) { if (CurrentBackBullet > 0) { PECommon.Log("正在换子弹"); if (shootTaskID != -10) { TimerSvc.Instance.RemoveTake(shootTaskID); shootTaskID = -10; } isLoadBullet = true; canShoot = false; isHold = false; BattleSys.Instance.Aim(false); M_GunViewBase.ExitHoldPose(weapenType, 0.2f, 60); BattleSys.Instance.SetLoadBulletState(true); BattleSys.Instance.ShowReloadBulletAni(weapenReload); TimerSvc.Instance.AddTimeTask((int tid) => { if (CurrentBackBullet >= weapenFrontBullet) { CurrentBackBullet = CurrentBackBullet - (weapenFrontBullet - CurrentFrontBullet); CurrentFrontBullet = weapenFrontBullet; } else if (CurrentFrontBullet + CurrentBackBullet > weapenFrontBullet) { CurrentBackBullet = CurrentFrontBullet + CurrentBackBullet - weapenFrontBullet; CurrentFrontBullet = weapenFrontBullet; } else { int tempCurrentBackBullet = CurrentBackBullet; CurrentBackBullet = 0; CurrentFrontBullet = CurrentFrontBullet + tempCurrentBackBullet; } isLoadBullet = false; canShoot = true; BattleSys.Instance.HideReloadBulletAni(); BattleSys.Instance.SetLoadBulletState(false); PECommon.Log("换弹完毕"); }, weapenReload, PETimeUnit.Second); } } }