//cancel actions like jumping, crouching, sprinting, reloading, and weapon switching //so player resumes after camera switch in a neutral state void CancelPlayerActions() { WeaponBehavior CurrentWeaponBehaviorComponent = PlayerWeaponsComponent.CurrentWeaponBehaviorComponent; PlayerWeaponsComponent.StopAllCoroutines(); CurrentWeaponBehaviorComponent.StopAllCoroutines(); FPSWalkerComponent.jumping = false; FPSWalkerComponent.landState = false; FPSWalkerComponent.jumpfxstate = true; FPSWalkerComponent.CameraAnimationComponent.Rewind("CameraLand"); FPSWalkerComponent.crouched = false; FPSWalkerComponent.crouchState = false; FPSWalkerComponent.crouchRisen = true; FPSWalkerComponent.prone = false; FPSWalkerComponent.proneState = false; FPSWalkerComponent.proneRisen = true; if (CurrentWeaponBehaviorComponent && !CurrentWeaponBehaviorComponent.PistolSprintAnim) { CurrentWeaponBehaviorComponent.AnimationComponent.Rewind("RifleSprinting"); CurrentWeaponBehaviorComponent.AnimationComponent["RifleSprinting"].normalizedTime = 0; } else { CurrentWeaponBehaviorComponent.AnimationComponent.Rewind("PistolSprinting"); CurrentWeaponBehaviorComponent.AnimationComponent["PistolSprinting"].normalizedTime = 0; } CurrentWeaponBehaviorComponent.gunAnglesTarget = Vector3.zero; if (PlayerWeaponsComponent.currentWeapon == PlayerWeaponsComponent.grenadeWeapon && !CurrentWeaponBehaviorComponent.cycleSelect) { PlayerWeaponsComponent.grenadeThrownState = true; } else { PlayerWeaponsComponent.grenadeThrownState = false; } PlayerWeaponsComponent.offhandThrowActive = false; PlayerWeaponsComponent.pullGrenadeState = false; CurrentWeaponBehaviorComponent.pullAnimState = false; CurrentWeaponBehaviorComponent.fireOnReleaseState = false; CurrentWeaponBehaviorComponent.doReleaseFire = false; CurrentWeaponBehaviorComponent.releaseAnimState = false; CurrentWeaponBehaviorComponent.fireHoldTimer = 0.0f; IronsightsComponent.switchMove = 0.0f; IronsightsComponent.reloading = false; FPSPlayerComponent.zoomed = false; IronsightsComponent.newFov = IronsightsComponent.defaultFov; IronsightsComponent.nextFov = IronsightsComponent.defaultFov; FPSWalkerComponent.cancelSprint = true; FPSWalkerComponent.sprintActive = false; FPSWalkerComponent.jumping = false; FPSWalkerComponent.landState = false; FPSWalkerComponent.jumpfxstate = true; FPSWalkerComponent.CameraAnimationComponent.Rewind("CameraLand"); if (CurrentWeaponBehaviorComponent.WeaponAnimationComponent) { CurrentWeaponBehaviorComponent.WeaponAnimationComponent.Stop(); CurrentWeaponBehaviorComponent.WeaponAnimationComponent.CrossFade("Fire", 0.01f, PlayMode.StopSameLayer); CurrentWeaponBehaviorComponent.WeaponAnimationComponent["Fire"].normalizedTime = 1f; } }
//cancel actions like jumping, crouching, sprinting, reloading, and weapon switching //so player resumes after camera switch in a neutral state void CancelPlayerActions() { WeaponBehavior CurrentWeaponBehaviorComponent = PlayerWeaponsComponent.CurrentWeaponBehaviorComponent; PlayerWeaponsComponent.StopAllCoroutines(); CurrentWeaponBehaviorComponent.StopAllCoroutines(); FPSWalkerComponent.jumping = false; FPSWalkerComponent.landState = false; FPSWalkerComponent.jumpfxstate = true; FPSWalkerComponent.crouched = false; FPSWalkerComponent.crouchState = false; FPSWalkerComponent.crouchRisen = true; FPSWalkerComponent.prone = false; FPSWalkerComponent.proneState = false; FPSWalkerComponent.proneRisen = true; CurrentWeaponBehaviorComponent.gunAnglesTarget = Vector3.zero; if (PlayerWeaponsComponent.currentWeapon == PlayerWeaponsComponent.grenadeWeapon && !CurrentWeaponBehaviorComponent.cycleSelect) { PlayerWeaponsComponent.grenadeThrownState = true; } else { PlayerWeaponsComponent.grenadeThrownState = false; } PlayerWeaponsComponent.offhandThrowActive = false; PlayerWeaponsComponent.pullGrenadeState = false; CurrentWeaponBehaviorComponent.pullAnimState = false; CurrentWeaponBehaviorComponent.fireOnReleaseState = false; CurrentWeaponBehaviorComponent.doReleaseFire = false; CurrentWeaponBehaviorComponent.releaseAnimState = false; CurrentWeaponBehaviorComponent.fireHoldTimer = 0.0f; IronsightsComponent.switchMove = 0.0f; IronsightsComponent.reloading = false; FPSPlayerComponent.zoomed = false; IronsightsComponent.newFov = IronsightsComponent.defaultFov; IronsightsComponent.nextFov = IronsightsComponent.defaultFov; FPSWalkerComponent.cancelSprint = true; FPSWalkerComponent.sprintActive = false; FPSWalkerComponent.jumping = false; FPSWalkerComponent.landState = false; FPSWalkerComponent.jumpfxstate = true; PlayerWeaponsComponent.cameraToggleState = true; PlayerWeaponsComponent.cameraToggleTime = Time.time; PlayerCharacterComponent.lastWeapon = -1; PlayerCharacterComponent.fireTime = -16; PlayerCharacterComponent.reloadStartTime = -16; CurrentWeaponBehaviorComponent.CancelWeaponPull(); IronsightsComponent.zPosRecNext = 0.0f; IronsightsComponent.zPosRec = 0.0f; CurrentWeaponBehaviorComponent.fireHoldMult = 0.0f; PlayerCharacterComponent.SelectCurrentWeapon(); }