protected void SetupEquipWeapons(EquipWeapons equipWeapons) { mustReleaseFireKey = false; currentCrosshairSetting = PlayerCharacterEntity.GetCrosshairSetting(); rightHandWeapon = equipWeapons.rightHand.GetWeaponItem(); leftHandWeapon = equipWeapons.leftHand.GetWeaponItem(); // Weapon ability will be able to use when equip weapon at main-hand only if (rightHandWeapon != null && leftHandWeapon == null) { if (rightHandWeapon.weaponAbility != weaponAbility) { if (weaponAbility != null) { weaponAbility.ForceDeactivated(); } weaponAbility = rightHandWeapon.weaponAbility; weaponAbility.Setup(this); weaponAbilityState = WeaponAbilityState.Deactivated; } } else { if (weaponAbility != null) { weaponAbility.ForceDeactivated(); } weaponAbility = null; weaponAbilityState = WeaponAbilityState.Deactivated; } }
public override WeaponAbilityState UpdateActivation(WeaponAbilityState state, float deltaTime) { if (state == WeaponAbilityState.Deactivating) { zoomInterpTime += deltaTime * ZOOM_SPEED; controllerCamera.fieldOfView = Mathf.Lerp(controllerCamera.fieldOfView, shooterController.DefaultGameplayCameraFOV, zoomInterpTime); if (zoomInterpTime >= 1f) { zoomInterpTime = 0; state = WeaponAbilityState.Deactivated; } } else if (state == WeaponAbilityState.Activating) { zoomInterpTime += deltaTime * ZOOM_SPEED; controllerCamera.fieldOfView = Mathf.Lerp(controllerCamera.fieldOfView, zoomingFov, zoomInterpTime); if (zoomInterpTime >= 1f) { zoomInterpTime = 0; state = WeaponAbilityState.Activated; } } tempActiveState = state == WeaponAbilityState.Deactivated || state == WeaponAbilityState.Deactivating; if (shooterController.crosshairRect != null && shooterController.crosshairRect.gameObject.activeSelf != tempActiveState) { shooterController.crosshairRect.gameObject.SetActive(tempActiveState); } tempActiveState = state == WeaponAbilityState.Activated || state == WeaponAbilityState.Activating; if (shooterController.zoomCrosshairImage != null && shooterController.zoomCrosshairImage.gameObject.activeSelf != tempActiveState) { shooterController.zoomCrosshairImage.gameObject.SetActive(tempActiveState); shooterController.zoomCrosshairImage.sprite = zoomCrosshair; } if (tempActiveState) { Vector3 offset = shooterController.CacheGameplayCameraControls.targetOffset; offset.x = 0f; shooterController.CacheGameplayCameraControls.targetOffset = offset; } else { shooterController.CacheGameplayCameraControls.targetOffset = shooterController.DefaultGameplayCameraOffset; } // Hidding character model shooterController.PlayerCharacterEntity.CharacterModel.SetHidding(tempActiveState); return(state); }
private void DeactivateWeaponAbility() { if (weaponAbility == null) { return; } if (weaponAbilityState == WeaponAbilityState.Deactivated || weaponAbilityState == WeaponAbilityState.Deactivating) { return; } weaponAbilityState = WeaponAbilityState.Deactivating; }
private void UpdateActivatedWeaponAbility(float deltaTime) { if (weaponAbility == null) { return; } if (weaponAbilityState == WeaponAbilityState.Activated || weaponAbilityState == WeaponAbilityState.Deactivated) { return; } weaponAbilityState = weaponAbility.UpdateActivation(weaponAbilityState, deltaTime); }
public void ActivateWeaponAbility() { if (weaponAbility == null) { return; } if (weaponAbilityState == WeaponAbilityState.Activated || weaponAbilityState == WeaponAbilityState.Activating) { return; } weaponAbilityState = WeaponAbilityState.Activating; }
public abstract WeaponAbilityState UpdateActivation(WeaponAbilityState state, float deltaTime);