3731 lines
113 KiB
C#
3731 lines
113 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using BeautifyEffect;
|
|
using BitStrap;
|
|
using CodeStage.AdvancedFPSCounter;
|
|
using Colorful;
|
|
using Moonlit.FootstepPro;
|
|
using Moonlit.IceFishing;
|
|
using UltimateWater;
|
|
using UnityEngine;
|
|
using UnityEngine.PostProcessing;
|
|
using UnityEngine.Rendering.PostProcessing;
|
|
using UnityEngine.UI;
|
|
using UnityStandardAssets.ImageEffects;
|
|
using VolumetricFogAndMist;
|
|
using uNature.Core.Seekers;
|
|
|
|
[RequireComponent(typeof(SphereCollider))]
|
|
public class FishingPlayer : MonoBehaviour
|
|
{
|
|
public enum PlayerState
|
|
{
|
|
NORMAL = 0,
|
|
FISHING = 1,
|
|
FISHING_NET = 2,
|
|
DRIVING_BOAT = 3,
|
|
WATCH_FISH = 4,
|
|
DRILLING = 5,
|
|
ICE_FISHING = 6,
|
|
RPG = 7,
|
|
ATTRACTOR = 8,
|
|
DEATH = 9
|
|
}
|
|
|
|
[HideInInspector]
|
|
public CharacterController characteController;
|
|
|
|
[HideInInspector]
|
|
public vp_FPController ufpsController;
|
|
|
|
[HideInInspector]
|
|
public vp_FPInput ufpsInput;
|
|
|
|
[HideInInspector]
|
|
public vp_FPWeaponHandler ufpsWeaponHandler;
|
|
|
|
[HideInInspector]
|
|
public vp_FPWeapon ufpsWeapon;
|
|
|
|
[HideInInspector]
|
|
public vp_FPPlayerEventHandler ufpsPlayerEventHandler;
|
|
|
|
[HideInInspector]
|
|
public vp_SimpleCrosshair ufpsSimpleCrosshair;
|
|
|
|
[HideInInspector]
|
|
public vp_FPCamera ufpsCamera;
|
|
|
|
[HideInInspector]
|
|
public Camera ufpsCameraCamera;
|
|
|
|
[HideInInspector]
|
|
public vp_FPInteractManager ufpsInteractiveManage;
|
|
|
|
[HideInInspector]
|
|
public vp_FootstepManager ufpsFootstepManager;
|
|
|
|
public Camera ufpsWeaponCamera;
|
|
|
|
public MaskCamera maskCamera;
|
|
|
|
public vp_FPBodyAnimator ufpsBodyAnimator;
|
|
|
|
[HideInInspector]
|
|
public MyFreeCamera freeCamera;
|
|
|
|
public UnderwaterCamera underwaterCamera;
|
|
|
|
public FloatCamera floatCamera;
|
|
|
|
public Camera baitIndicatorCamera;
|
|
|
|
public FishingPlayerRemote fishingPlayerRemote;
|
|
|
|
[ReadOnly]
|
|
public BaitIndicator baitIndicator;
|
|
|
|
public BaitIndicator baitIndicatorPrefab;
|
|
|
|
[HideInInspector]
|
|
public CameraFilterPack_FX_Drunk fxDrunk;
|
|
|
|
[HideInInspector]
|
|
public CameraFilterPack_AAA_Blood_Hit fxBlood1;
|
|
|
|
[HideInInspector]
|
|
public VolumetricFog volumetricFog;
|
|
|
|
[HideInInspector]
|
|
public HueFocus hueFocus;
|
|
|
|
[HideInInspector]
|
|
public Colorful.Grayscale grayscale;
|
|
|
|
[HideInInspector]
|
|
public VintageFast vintageFast;
|
|
|
|
[HideInInspector]
|
|
public SunShafts sunShafts;
|
|
|
|
[HideInInspector]
|
|
public CameraFilterPack_AAA_WaterDropPro currentWaterDropPro;
|
|
|
|
[HideInInspector]
|
|
public CameraFilterPack_AAA_WaterDropPro waterDropPro;
|
|
|
|
[HideInInspector]
|
|
public CameraFilterPack_AAA_WaterDropPro waterDropProUnderwater;
|
|
|
|
[HideInInspector]
|
|
public CameraFilterPack_Colors_Brightness hunterBrightness;
|
|
|
|
[HideInInspector]
|
|
public UnityStandardAssets.ImageEffects.DepthOfField depthOfField;
|
|
|
|
[HideInInspector]
|
|
public WaterCamera waterCamera;
|
|
|
|
[HideInInspector]
|
|
public WaterCamera underwaterWaterCamera;
|
|
|
|
[HideInInspector]
|
|
public WaterRaindropsIME waterRaindropsIME;
|
|
|
|
[HideInInspector]
|
|
public WaterDropsRainMy waterDropsRainMy;
|
|
|
|
[HideInInspector]
|
|
public PostProcessingBehaviour postProcessingBehaviour_1;
|
|
|
|
[HideInInspector]
|
|
public PostProcessingBehaviour postProcessingBehaviour_2;
|
|
|
|
[HideInInspector]
|
|
public PostProcessLayer postProcessLayer;
|
|
|
|
[HideInInspector]
|
|
public Beautify beautify;
|
|
|
|
[HideInInspector]
|
|
public AmplifyMotionEffect amplifyMotionEffect;
|
|
|
|
[HideInInspector]
|
|
public AmplifyOcclusionEffect amplifyOcclusion;
|
|
|
|
[HideInInspector]
|
|
public AmplifyOcclusionEffect amplifyOcclusionUnderwater;
|
|
|
|
[HideInInspector]
|
|
public UNSeeker unSeeker;
|
|
|
|
[ReadOnly]
|
|
public bool isHandsCameraVisible = true;
|
|
|
|
[ReadOnly]
|
|
public bool isOnIce;
|
|
|
|
private Texture defaultCrosshair;
|
|
|
|
public float resetPlayerInWater = -2f;
|
|
|
|
public float waterMaxClipRange = 1000f;
|
|
|
|
public float playerHeight = 1.7f;
|
|
|
|
public bool canFallInWater;
|
|
|
|
[HideInInspector]
|
|
public GameController gameController;
|
|
|
|
public FishingController fishingController;
|
|
|
|
[HideInInspector]
|
|
public Vector3 prevPosition = Vector3.zero;
|
|
|
|
[ReadOnly]
|
|
public Vector3 fishingStartPosition = Vector3.zero;
|
|
|
|
[HideInInspector]
|
|
public Transform startTransform;
|
|
|
|
public PlayerState currentState;
|
|
|
|
public Vector2 verticalMaxRotation = new Vector2(89f, -45f);
|
|
|
|
public Vector2 verticalMaxRotationIce = new Vector2(55f, -55f);
|
|
|
|
[Space(10f)]
|
|
public FishingHands currentHands;
|
|
|
|
public List<FishingHands> allFishingHands = new List<FishingHands>();
|
|
|
|
[HideInInspector]
|
|
public DrillingController drillingController;
|
|
|
|
[HideInInspector]
|
|
public TournamentPlayer tournamentPlayer;
|
|
|
|
public LayerMask checkWaterMask = 1;
|
|
|
|
[ReadOnly]
|
|
public float currentMotorAcceleration = 0.18f;
|
|
|
|
public Vector2 motorAccelerationValues = new Vector2(0.18f, 0.09f);
|
|
|
|
[HideInInspector]
|
|
public BoatSimulator boatSimulator;
|
|
|
|
[Space(10f)]
|
|
public GameObject unistormCamera;
|
|
|
|
public ParticleSystem rain;
|
|
|
|
public ParticleSystem snow;
|
|
|
|
public ParticleSystem lightningBugs;
|
|
|
|
public ParticleSystem rainMist;
|
|
|
|
public ParticleSystem snowDust;
|
|
|
|
public GameObject rainStreaks;
|
|
|
|
public ParticleSystem windyLeaves;
|
|
|
|
public GameObject lightningBolt1;
|
|
|
|
public ParticleSystem rainSplash;
|
|
|
|
public Transform lightningPosition;
|
|
|
|
[Space(10f)]
|
|
[ReadOnly]
|
|
public Fish fish;
|
|
|
|
[ReadOnly]
|
|
public Junk junk;
|
|
|
|
public float xOffset;
|
|
|
|
public float xOffsetMax = 1f;
|
|
|
|
public Vector3 rodStartPos = Vector3.zero;
|
|
|
|
public Vector3 baitStartPos = Vector3.zero;
|
|
|
|
public Vector3 pullDirection = Vector3.zero;
|
|
|
|
public float pullForce;
|
|
|
|
public float pullSpeed = 1f;
|
|
|
|
public float maxPullForce = 3f;
|
|
|
|
public float pullRodSpeed = 5f;
|
|
|
|
[Space(10f)]
|
|
public float checkWaterDistance = 4f;
|
|
|
|
public float sitHeight = 0.6f;
|
|
|
|
public float defaultHoleDistance = 1f;
|
|
|
|
public float fishDistanceAnimation = 2f;
|
|
|
|
public float fishDistanceBehavior = 100f;
|
|
|
|
public float fishDistanceBoatBehavior = 350f;
|
|
|
|
[ReadOnly]
|
|
public float currentFishDistanceBehavior;
|
|
|
|
public Transform fishDistanceBehaviorSphere;
|
|
|
|
[ReadOnly]
|
|
public float distanceToBait;
|
|
|
|
[HideInInspector]
|
|
public Fish.WatchStyle currentWatchStyle;
|
|
|
|
[HideInInspector]
|
|
public GaussianBlur gaussianBlur;
|
|
|
|
public static bool playerWasInBoat;
|
|
|
|
public Fish tempFishPrefab;
|
|
|
|
private bool AllowGameplayInput = true;
|
|
|
|
[ReadOnly]
|
|
public Vector2 MouseLookSensitivity = new Vector2(-1f, -1f);
|
|
|
|
[ReadOnly]
|
|
public Vector2 CurrentMouseLookSensitivity = new Vector2(-1f, -1f);
|
|
|
|
public float CurrentFieldOfView = 60f;
|
|
|
|
public float ZoomFieldOfView = 1f;
|
|
|
|
public float playersZoom = 0.75f;
|
|
|
|
[HideInInspector]
|
|
public float RotationSpringStiffness = 0.02f;
|
|
|
|
[HideInInspector]
|
|
public float RotationSpringDamping = 0.37f;
|
|
|
|
public Foot leftFoot;
|
|
|
|
public Foot rightFoot;
|
|
|
|
[ReadOnly]
|
|
public bool baitCanBeThrown;
|
|
|
|
[HideInInspector]
|
|
public bool isIceBaitReseted = true;
|
|
|
|
[HideInInspector]
|
|
public bool isDrillerReady;
|
|
|
|
[HideInInspector]
|
|
public bool isDrinking;
|
|
|
|
[HideInInspector]
|
|
public bool isEating;
|
|
|
|
[HideInInspector]
|
|
public bool isPissing;
|
|
|
|
[HideInInspector]
|
|
public bool isPooing;
|
|
|
|
[ReadOnly]
|
|
public bool isThrowingExplosive;
|
|
|
|
[HideInInspector]
|
|
public bool isJerkOn;
|
|
|
|
[HideInInspector]
|
|
public bool wasJustJerked;
|
|
|
|
[HideInInspector]
|
|
public bool isHunterVisionOn;
|
|
|
|
[HideInInspector]
|
|
public bool isDuringAnimation;
|
|
|
|
[HideInInspector]
|
|
public bool wasLateInitialized;
|
|
|
|
public Camera hunterCamera;
|
|
|
|
[ReadOnly]
|
|
public AudioObject hunterAudio;
|
|
|
|
public WaterInteractive waterInteractive;
|
|
|
|
public WaterSimulationArea waterSimulationSpace;
|
|
|
|
[ReadOnly]
|
|
public bool isInWater;
|
|
|
|
[ReadOnly]
|
|
public bool allowRun = true;
|
|
|
|
[ReadOnly]
|
|
public bool allowFishing = true;
|
|
|
|
public float hookLoseChance = 0.3f;
|
|
|
|
public float strengthLevel;
|
|
|
|
[ReadOnly]
|
|
public float currentStrengthLevel;
|
|
|
|
public float foodLevel;
|
|
|
|
public float drunkLevel;
|
|
|
|
public float pissingLevel;
|
|
|
|
public float pissingIncFactor = 0.001f;
|
|
|
|
public bool pissingLevelOverLimit;
|
|
|
|
public ParticleSystem pissingParticles;
|
|
|
|
public ParticleEmitter pissingParticlesOld;
|
|
|
|
public float pooLevel;
|
|
|
|
public float pooIncFactor = 0.001f;
|
|
|
|
public GameObject pooPrefab;
|
|
|
|
public ParticleSystem dustParticles;
|
|
|
|
[ReadOnly]
|
|
public float PlayerFishStrengthDiff;
|
|
|
|
[ReadOnly]
|
|
public float DragFishStrengthDiff;
|
|
|
|
[Header("VR")]
|
|
public Image vrFadeImage;
|
|
|
|
public Transform vrHandsParent;
|
|
|
|
public Transform vrHUDParent;
|
|
|
|
public VRPlayertUIInput vrPlayertUIInput;
|
|
|
|
public OVRPlayerController ovrPlayerController;
|
|
|
|
public AFPSCounter afpsCounter;
|
|
|
|
public float vrHUDHeight;
|
|
|
|
public Vector3 vrHUDOffset = new Vector3(0f, 0f, 0.9f);
|
|
|
|
private bool vrWasLeftHanded;
|
|
|
|
public bool vrLateUpdateHands;
|
|
|
|
[ReadOnly]
|
|
public Vector3 vrWheelMoveLastPosition = Vector3.zero;
|
|
|
|
public float vrWatchHandsCameraStartAngle;
|
|
|
|
public bool newFloatRopeRegenerate;
|
|
|
|
[HideInInspector]
|
|
public new Transform transform;
|
|
|
|
public bool isTeleporting;
|
|
|
|
private float lastFloatDepthInput;
|
|
|
|
private float floatDepthInputDelay = 0.06f;
|
|
|
|
private float lastFloatDepthInputDown;
|
|
|
|
private float fastFloatDepthIncrese = 5f;
|
|
|
|
private float fastFloatDepthDelay = 3f;
|
|
|
|
public float checkBoatHeight = 0.1f;
|
|
|
|
public float vrMinCameraHeight = 0.5f;
|
|
|
|
private bool vrWasCameraUnderwater;
|
|
|
|
public bool vrChangeRopeParent = true;
|
|
|
|
public bool vrUpdateRopePosition = true;
|
|
|
|
public float vrHandsScale = 0.8f;
|
|
|
|
[ReadOnly]
|
|
public Vector3 vrHUDTargetRotation = Vector3.zero;
|
|
|
|
public float vrHUDRotationSpeed = 0.2f;
|
|
|
|
[ReadOnly]
|
|
public float vrHUDRotationThreshold = 20f;
|
|
|
|
public bool vrHUDFreeIsRotating;
|
|
|
|
private LTDescr vrHUDRotationTween;
|
|
|
|
private void Awake()
|
|
{
|
|
transform = GetComponent<Transform>();
|
|
if (VRManager.IsVROn() && (bool)VRControllersManager.Instance && VRControllersManager.Instance.IsLeftHanded() && (bool)GameController.Instance)
|
|
{
|
|
VRControllersManager.Instance.SetLeftHanded(false);
|
|
vrWasLeftHanded = true;
|
|
}
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
if ((bool)postProcessingBehaviour_1 && !VRManager.IsVROn())
|
|
{
|
|
AntialiasingModel.Settings settings = postProcessingBehaviour_1.profile.antialiasing.settings;
|
|
settings.taaSettings.stationaryBlending = 0.85f;
|
|
settings.taaSettings.motionBlending = 0.75f;
|
|
postProcessingBehaviour_1.profile.antialiasing.settings = settings;
|
|
}
|
|
WaterProjectSettings.Instance.ClipWaterCameraRange = true;
|
|
WaterProjectSettings.Instance.CameraClipRange = 1000f;
|
|
}
|
|
|
|
public void Initialize()
|
|
{
|
|
gameController = GameController.Instance;
|
|
characteController = GetComponent<CharacterController>();
|
|
ufpsController = GetComponent<vp_FPController>();
|
|
ufpsInput = GetComponent<vp_FPInput>();
|
|
ufpsWeaponHandler = GetComponent<vp_FPWeaponHandler>();
|
|
ufpsWeapon = GetComponentInChildren<vp_FPWeapon>();
|
|
ufpsPlayerEventHandler = GetComponent<vp_FPPlayerEventHandler>();
|
|
ufpsSimpleCrosshair = GetComponent<vp_SimpleCrosshair>();
|
|
ufpsCamera = GetComponentInChildren<vp_FPCamera>();
|
|
ufpsCamera.GetComponent<UnderwaterIME>().EffectEnabled = false;
|
|
ufpsCameraCamera = ufpsCamera.GetComponent<Camera>();
|
|
ufpsInteractiveManage = GetComponent<vp_FPInteractManager>();
|
|
ufpsFootstepManager = GetComponent<vp_FootstepManager>();
|
|
defaultCrosshair = ufpsSimpleCrosshair.m_ImageCrosshair;
|
|
freeCamera = ufpsCamera.GetComponent<MyFreeCamera>();
|
|
freeCamera.enabled = false;
|
|
underwaterCamera.fishingPlayer = this;
|
|
gaussianBlur = ufpsWeaponCamera.GetComponent<GaussianBlur>();
|
|
if ((bool)gaussianBlur)
|
|
{
|
|
gaussianBlur.enabled = false;
|
|
}
|
|
fxDrunk = ufpsWeaponCamera.GetComponent<CameraFilterPack_FX_Drunk>();
|
|
fxBlood1 = ufpsWeaponCamera.GetComponent<CameraFilterPack_AAA_Blood_Hit>();
|
|
volumetricFog = ufpsCamera.GetComponent<VolumetricFog>();
|
|
hueFocus = ufpsWeaponCamera.GetComponent<HueFocus>();
|
|
grayscale = ufpsWeaponCamera.GetComponent<Colorful.Grayscale>();
|
|
vintageFast = ufpsWeaponCamera.GetComponent<VintageFast>();
|
|
sunShafts = ufpsWeaponCamera.GetComponent<SunShafts>();
|
|
waterDropPro = ufpsWeaponCamera.GetComponent<CameraFilterPack_AAA_WaterDropPro>();
|
|
waterDropProUnderwater = underwaterCamera.GetComponent<CameraFilterPack_AAA_WaterDropPro>();
|
|
currentWaterDropPro = waterDropPro;
|
|
hunterBrightness = ufpsWeaponCamera.GetComponent<CameraFilterPack_Colors_Brightness>();
|
|
depthOfField = ufpsCamera.GetComponent<UnityStandardAssets.ImageEffects.DepthOfField>();
|
|
waterCamera = ufpsCamera.GetComponent<WaterCamera>();
|
|
underwaterWaterCamera = underwaterCamera.GetComponent<WaterCamera>();
|
|
waterRaindropsIME = ufpsWeaponCamera.GetComponent<WaterRaindropsIME>();
|
|
waterDropsRainMy = rain.GetComponent<WaterDropsRainMy>();
|
|
postProcessingBehaviour_1 = ufpsCamera.GetComponent<PostProcessingBehaviour>();
|
|
postProcessingBehaviour_2 = ufpsWeaponCamera.GetComponent<PostProcessingBehaviour>();
|
|
beautify = ufpsWeaponCamera.GetComponent<Beautify>();
|
|
amplifyMotionEffect = ufpsCamera.GetComponent<AmplifyMotionEffect>();
|
|
amplifyOcclusion = ufpsCamera.GetComponent<AmplifyOcclusionEffect>();
|
|
amplifyOcclusionUnderwater = underwaterCamera.GetComponent<AmplifyOcclusionEffect>();
|
|
unSeeker = ufpsCamera.GetComponent<UNSeeker>();
|
|
if (VRManager.IsVROn())
|
|
{
|
|
postProcessLayer = ufpsCamera.GetComponent<PostProcessLayer>();
|
|
}
|
|
else
|
|
{
|
|
postProcessLayer = ufpsWeaponCamera.GetComponent<PostProcessLayer>();
|
|
ufpsCamera.GetComponent<PostProcessLayer>().antialiasingMode = PostProcessLayer.Antialiasing.None;
|
|
}
|
|
depthOfField.focalLength = 0.8f;
|
|
waterSimulationSpace = GetComponentInChildren<WaterSimulationArea>(true);
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
waterSimulationSpace.gameObject.SetActive(false);
|
|
}
|
|
maskCamera = ufpsCamera.GetComponentInChildren<MaskCamera>(true);
|
|
maskCamera.gameObject.SetActive(gameController.iceLevel);
|
|
floatCamera.fishingPlayer = this;
|
|
floatCamera.Initialize();
|
|
baitIndicator = UnityEngine.Object.Instantiate(baitIndicatorPrefab);
|
|
gameController.hudManager.hudFishing.baitIndicator = baitIndicator;
|
|
SetDrunkLevel(0f, true);
|
|
if ((bool)fxDrunk)
|
|
{
|
|
fxDrunk.enabled = false;
|
|
}
|
|
drillingController = GetComponent<DrillingController>();
|
|
drillingController.fishingPlayer = this;
|
|
ufpsController.MotorAcceleration = (currentMotorAcceleration = motorAccelerationValues.x);
|
|
ufpsBodyAnimator.gameObject.SetActive(false);
|
|
if (currentHands == null)
|
|
{
|
|
currentHands = GetComponentInChildren<FishingHands>(false);
|
|
if ((bool)currentHands)
|
|
{
|
|
currentHands.SetFishingPlayer();
|
|
}
|
|
}
|
|
RefreshWeatherSettings();
|
|
ChangeState(PlayerState.NORMAL);
|
|
BlockMouseLook(true);
|
|
ovrPlayerController.gameObject.SetActive(VRManager.IsVROn());
|
|
afpsCounter.gameObject.SetActive(VRManager.IsVROn() && VRManager.Instance.showAfpsCounter);
|
|
if ((bool)GlobalSettings.Instance && GlobalSettings.Instance.turnOnMyCheats && VRManager.IsVROn())
|
|
{
|
|
afpsCounter.gameObject.SetActive(true);
|
|
}
|
|
afpsCounter.Shadow = true;
|
|
if (VRManager.IsVROn())
|
|
{
|
|
VRManager.Instance.InitializePlayer(this);
|
|
HUDManager.Instance.InitializeVR();
|
|
ChangeVRCameraHeight(VRManager.Instance.cameraHeight);
|
|
ufpsCameraCamera.nearClipPlane = 0.1f;
|
|
defaultHoleDistance = -0.2f;
|
|
}
|
|
}
|
|
|
|
public void LateInitialize()
|
|
{
|
|
if (wasLateInitialized)
|
|
{
|
|
return;
|
|
}
|
|
UpdateFOV(true);
|
|
ufpsWeaponCamera.depth = 2f;
|
|
HUDManager.Instance.ShowRadar(false);
|
|
SetPosition(startTransform.position);
|
|
SetRotation(startTransform.eulerAngles);
|
|
if (gameController.iceLevel)
|
|
{
|
|
ufpsWeapon.ShakeSpeed = 0.13f;
|
|
ufpsWeapon.ShakeAmplitude = new Vector3(0.25f, 0.4f, 0.4f);
|
|
}
|
|
LeanTween.delayedCall(0.01f, (Action)delegate
|
|
{
|
|
currentHands.ChangeRod();
|
|
});
|
|
ResetFishing();
|
|
currentHands.fishingRod.ResetBend();
|
|
currentHands.flashLight.enabled = false;
|
|
SitDown(-1f);
|
|
LeanTween.delayedCall((!gameController.spawnAllAtStart) ? 2f : 0.5f, (Action)delegate
|
|
{
|
|
gameController.hudManager.FadeDark(0f, 1.5f, true);
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
}
|
|
});
|
|
if (gameController.iceLevel)
|
|
{
|
|
if (!GlobalSettings.Instance || (bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.USE_DRILLER_1).isUnlocked)
|
|
{
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.DRILL_01, 2f);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.ENTER_FISHERY_01, 2f);
|
|
}
|
|
if (gameController.oceanLevel)
|
|
{
|
|
playerWasInBoat = true;
|
|
BoatSimulator boat = UnityEngine.Object.FindObjectOfType<BoatSimulator>();
|
|
EnterBoatInstant(true, boat);
|
|
}
|
|
else if (playerWasInBoat)
|
|
{
|
|
BoatSimulator boatSimulator = UnityEngine.Object.FindObjectOfType<BoatSimulator>();
|
|
boatSimulator.ReturnBoat();
|
|
EnterBoatInstant(true, boatSimulator);
|
|
playerWasInBoat = false;
|
|
}
|
|
BlockMouseLook(false);
|
|
CurrentMouseLookSensitivity = new Vector2(4f, 4f);
|
|
MouseLookSensitivity = CurrentMouseLookSensitivity;
|
|
RefreshInputSettings();
|
|
waterSimulationSpace.enabled = true;
|
|
for (int num = 0; num < gameController.fishSpawners.Count; num++)
|
|
{
|
|
if (gameController.fishSpawners[num].gameObject.activeSelf && (gameController.spawnAllAtStart || gameController.fishSpawners[num].spawnAtStart))
|
|
{
|
|
gameController.fishSpawners[num].CheckBehaviorDistanceQuick();
|
|
gameController.fishSpawners[num].CheckBehaviorDistance();
|
|
}
|
|
}
|
|
if ((bool)VRManager.Instance)
|
|
{
|
|
VRManager.Instance.LateInitializePlayer(this);
|
|
}
|
|
if (VRManager.IsVROn() && vrWasLeftHanded)
|
|
{
|
|
VRControllersManager.Instance.SetLeftHanded(true);
|
|
}
|
|
wasLateInitialized = true;
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!GameController.Instance)
|
|
{
|
|
GetComponent<vp_FPInput>().MakeUpdate();
|
|
}
|
|
if (gameController == null || !gameController.isInitialized || currentHands == null)
|
|
{
|
|
return;
|
|
}
|
|
if (!vrLateUpdateHands)
|
|
{
|
|
UpdateVRHands();
|
|
}
|
|
if (gameController.IsPauseMenu() || gameController.IsQuickMenu() || (isHandsCameraVisible && (!currentHands.fishingRod.rodMegaAttach || !currentHands.fishingRod.rodMegaAttach.attached)) || ((bool)BugReporter.Instance && BugReporter.Instance.isVisible))
|
|
{
|
|
return;
|
|
}
|
|
if (VRManager.IsVROn())
|
|
{
|
|
UpdateRoomscale();
|
|
}
|
|
if (HUDManager.Instance.hudMultiplayer.isInInputMode)
|
|
{
|
|
if (currentState == PlayerState.ICE_FISHING || currentState == PlayerState.FISHING)
|
|
{
|
|
}
|
|
if ((bool)currentHands && (bool)currentHands.fishingLine)
|
|
{
|
|
if (currentHands.baitWasThrown)
|
|
{
|
|
currentHands.fishingLine.MakeUpdate();
|
|
}
|
|
else
|
|
{
|
|
currentHands.fishingLine.currentTension = 0f;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (currentState == PlayerState.DEATH)
|
|
{
|
|
return;
|
|
}
|
|
ufpsInput.MakeUpdate();
|
|
if (allowRun && !isDrinking && !boatSimulator)
|
|
{
|
|
ufpsInput.InputRun();
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
if (UtilitiesInput.GetButton("RUN"))
|
|
{
|
|
ufpsWeapon.BobRate.x = 1.2f;
|
|
}
|
|
else
|
|
{
|
|
ufpsWeapon.BobRate.x = 0.8f;
|
|
}
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("RUN"))
|
|
{
|
|
Zoom(false, 0.2f);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ufpsInput.FPPlayer.Run.TryStop();
|
|
ufpsWeapon.BobRate.x = 0.8f;
|
|
}
|
|
if (isPissing || isDrinking || isEating || isPooing)
|
|
{
|
|
return;
|
|
}
|
|
UpdateParams();
|
|
if (currentHands.baitWasThrown)
|
|
{
|
|
underwaterCamera.UpdateProperHeight();
|
|
}
|
|
if (GlobalSettings.Instance == null || ((bool)GlobalSettings.Instance && GlobalSettings.Instance.turnOnCheats))
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.PageUp))
|
|
{
|
|
Fish fish = UnityEngine.Object.Instantiate(tempFishPrefab);
|
|
this.fish = fish;
|
|
FishCatch();
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.M))
|
|
{
|
|
gameController.hudManager.ShowRadar(!gameController.hudManager.minimapGui.activeSelf);
|
|
}
|
|
if (Input.GetKey(KeyCode.LeftControl))
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.R))
|
|
{
|
|
currentHands.currentRope.regenerateRope(true);
|
|
if ((bool)currentHands.fishingFloat)
|
|
{
|
|
currentHands.floatRope.regenerateRope(true);
|
|
}
|
|
}
|
|
if (Input.GetKeyDown(KeyCode.C) && (bool)this.fish)
|
|
{
|
|
this.fish.DurabilityCurrent = Fish.DurabilityMin;
|
|
}
|
|
if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.V))
|
|
{
|
|
if ((bool)this.fish)
|
|
{
|
|
FishCatch();
|
|
}
|
|
else if ((bool)junk)
|
|
{
|
|
StartCoroutine(ShowCatchObject());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (gameController.iceLevel)
|
|
{
|
|
CheckIsOnIce();
|
|
}
|
|
if (VRManager.IsVROn() && currentState != PlayerState.WATCH_FISH && currentState != PlayerState.ICE_FISHING && (currentState != PlayerState.DRILLING || !drillingController.placeChosen) && currentState != PlayerState.DRIVING_BOAT)
|
|
{
|
|
float num = ((!currentHands.baitWasThrown) ? 0f : Mathf.Abs(VRInputManager.GetAxis("LOOK_VERTICAL")));
|
|
if (num < 0.25f)
|
|
{
|
|
if (VRManager.Instance.playerRotateStyle == VRManager.PlayerRotateStyle.STEP)
|
|
{
|
|
if (UtilitiesInput.GetButtonDown("VR_TURN_LEFT") || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickLeft, OVRInput.Controller.Gamepad) || UtilitiesInput.isRThumbstickLeft)
|
|
{
|
|
SetRotation(new Vector3(transform.eulerAngles.x, transform.eulerAngles.y - VRManager.Instance.turnAngle, transform.eulerAngles.z));
|
|
}
|
|
else if (UtilitiesInput.GetButtonDown("VR_TURN_RIGHT") || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickRight, OVRInput.Controller.Gamepad) || UtilitiesInput.isRThumbstickRight)
|
|
{
|
|
SetRotation(new Vector3(transform.eulerAngles.x, transform.eulerAngles.y + VRManager.Instance.turnAngle, transform.eulerAngles.z));
|
|
}
|
|
}
|
|
else if (VRManager.Instance.playerRotateStyle == VRManager.PlayerRotateStyle.FADE_STEP)
|
|
{
|
|
if (UtilitiesInput.GetButtonDown("VR_TURN_LEFT") || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickLeft, OVRInput.Controller.Gamepad) || UtilitiesInput.isRThumbstickLeft)
|
|
{
|
|
StartCoroutine(SetRotationFade(new Vector3(transform.eulerAngles.x, transform.eulerAngles.y - VRManager.Instance.turnAngle, transform.eulerAngles.z), VRManager.Instance.fadeDuration));
|
|
}
|
|
else if (UtilitiesInput.GetButtonDown("VR_TURN_RIGHT") || OVRInput.GetDown(OVRInput.Button.SecondaryThumbstickRight, OVRInput.Controller.Gamepad) || UtilitiesInput.isRThumbstickRight)
|
|
{
|
|
StartCoroutine(SetRotationFade(new Vector3(transform.eulerAngles.x, transform.eulerAngles.y + VRManager.Instance.turnAngle, transform.eulerAngles.z), VRManager.Instance.fadeDuration));
|
|
}
|
|
}
|
|
else if (VRManager.Instance.playerRotateStyle == VRManager.PlayerRotateStyle.FREE && Mathf.Abs(UtilitiesInput.lookAxis.x) > 0.3f)
|
|
{
|
|
SetRotation(new Vector3(transform.eulerAngles.x, transform.eulerAngles.y + VRManager.Instance.freeTurnSpeed * Time.deltaTime * UtilitiesInput.lookAxis.x, transform.eulerAngles.z));
|
|
}
|
|
}
|
|
if (!VRManager.Instance.IsPlayerFollowCamera())
|
|
{
|
|
}
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("FLASHLIGHT"))
|
|
{
|
|
ToggleFlashlight();
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("HUNTER_VISION"))
|
|
{
|
|
TurnOnHunterVision();
|
|
}
|
|
if ((currentState == PlayerState.FISHING || currentState == PlayerState.ICE_FISHING) && !Input.GetKey(KeyCode.LeftControl) && UtilitiesInput.GetButtonDown("UNDERWATER_CAMERA"))
|
|
{
|
|
if ((bool)GlobalSettings.Instance && !GlobalSettings.Instance.playerSettings.IsCasual())
|
|
{
|
|
gameController.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/NO_UNDERWATER_REALISTIC"));
|
|
}
|
|
else if (!underwaterCamera.isTurnedOn && currentHands.ThrowObjectOnWater() && underwaterCamera.HasProperHeight() && !grayscale.enabled && isHandsCameraVisible && !currentHands.fishingRod.isOnRodStand && (!currentHands.isGroundRig || (bool)this.fish || !GlobalSettings.Instance))
|
|
{
|
|
StartCoroutine(underwaterCamera.TurnOn(true));
|
|
}
|
|
else if (underwaterCamera.isTurnedOn)
|
|
{
|
|
StartCoroutine(underwaterCamera.TurnOn(false));
|
|
}
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("EQUIPMENT_SET_1"))
|
|
{
|
|
StartCoroutine(ChangeEquipmentSet(0));
|
|
}
|
|
else if (UtilitiesInput.GetButtonDown("EQUIPMENT_SET_2"))
|
|
{
|
|
StartCoroutine(ChangeEquipmentSet(1));
|
|
}
|
|
else if (UtilitiesInput.GetButtonDown("EQUIPMENT_SET_3"))
|
|
{
|
|
StartCoroutine(ChangeEquipmentSet(2));
|
|
}
|
|
else if (UtilitiesInput.GetButtonDown("EQUIPMENT_SET_4"))
|
|
{
|
|
StartCoroutine(ChangeEquipmentSet(3));
|
|
}
|
|
else if (UtilitiesInput.GetButtonDown("EQUIPMENT_SET_5"))
|
|
{
|
|
StartCoroutine(ChangeEquipmentSet(4));
|
|
}
|
|
CheckFloatDepthInput();
|
|
if ((bool)FishingHands.rodStand && currentState == PlayerState.FISHING && !underwaterCamera.isTurnedOn)
|
|
{
|
|
float num2 = Vector3.Distance(transform.position, FishingHands.rodStand.transform.position);
|
|
if (!FishingHands.rodStand.gameObject.activeSelf && UtilitiesInput.GetButtonDown("ROD_STAND_PUT"))
|
|
{
|
|
FishingHands.rodStand.PutStand();
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
else if (FishingHands.rodStand.gameObject.activeSelf && !FishingHands.rodStand.isBoatStand && UtilitiesInput.GetButtonDown("ROD_STAND_TAKE"))
|
|
{
|
|
if (num2 > 3f)
|
|
{
|
|
gameController.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/ROD_POD_FAR"));
|
|
}
|
|
else if (FishingHands.rodStand.rodPlacesOccupied > 0)
|
|
{
|
|
gameController.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/ROD_POD_NOT_EMPTY"));
|
|
}
|
|
else
|
|
{
|
|
FishingHands.rodStand.TakeStand();
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
}
|
|
else if (FishingHands.rodStand.gameObject.activeSelf && !currentHands.fishingRod.isOnRodStand && !IsFishOnCurrentRod() && UtilitiesInput.GetButtonDown("ROD_STAND_PUT_ROD"))
|
|
{
|
|
if (FishingHands.rodStand.gameObject.activeSelf && currentHands.bait.isOnWater && !currentHands.fishingRod.isOnRodStand && num2 < 3f)
|
|
{
|
|
FishingHands.rodStand.PutRod(currentHands.fishingRod);
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
else if (!currentHands.bait.isOnWater)
|
|
{
|
|
gameController.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/ROD_POD_CAST"));
|
|
}
|
|
else if (num2 >= 3f)
|
|
{
|
|
gameController.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/ROD_POD_FAR"));
|
|
}
|
|
}
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("BOILIE_2") && currentState == PlayerState.ICE_FISHING && !isThrowingExplosive && !this.fish)
|
|
{
|
|
if (!GlobalSettings.Instance || GlobalSettings.Instance.equipmentManager.HasBoilieEquiped())
|
|
{
|
|
currentHands.ThrowBoilieIce();
|
|
}
|
|
return;
|
|
}
|
|
if ((currentState == PlayerState.NORMAL || currentState == PlayerState.FISHING) && !currentHands.baitWasThrown && !gameController.hudManager.hudFishing.throwStrengthBar.gameObject.activeInHierarchy && !isThrowingExplosive && !currentHands.isThrowingNear && !currentHands.isThrowing)
|
|
{
|
|
if (UtilitiesInput.GetButtonDown("BOILIE") && currentState == PlayerState.FISHING)
|
|
{
|
|
if (!currentHands.currentBoilie && isHandsCameraVisible && (!GlobalSettings.Instance || GlobalSettings.Instance.equipmentManager.HasBoilieEquiped()))
|
|
{
|
|
currentHands.ThrowBoilie();
|
|
}
|
|
return;
|
|
}
|
|
if (UtilitiesInput.GetButtonUp("BOILIE") && currentState == PlayerState.FISHING && (bool)currentHands.currentBoilie && VRManager.Instance.IsVRGroundBait())
|
|
{
|
|
currentHands.ThrowBoilieEvent();
|
|
return;
|
|
}
|
|
if ((GlobalSettings.Instance == null || ((bool)GlobalSettings.Instance && GlobalSettings.Instance.turnOnCheats)) && Input.GetKeyDown(KeyCode.F10))
|
|
{
|
|
gameController.QuickJump();
|
|
}
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("RESET_PLAYER") && !gameController.oceanLevel && !boatSimulator && (currentState == PlayerState.NORMAL || currentState == PlayerState.FISHING))
|
|
{
|
|
StartCoroutine(gameController.ResetPlayer(true));
|
|
}
|
|
if (isPissing)
|
|
{
|
|
if (UtilitiesInput.isReelingIn)
|
|
{
|
|
float num3 = pissingParticlesOld.transform.localEulerAngles.x + Time.deltaTime * 80f;
|
|
if (num3 > 50f && num3 < 180f)
|
|
{
|
|
num3 = 50f;
|
|
}
|
|
pissingParticlesOld.transform.localEulerAngles = new Vector3(num3, pissingParticlesOld.transform.localEulerAngles.y, pissingParticlesOld.transform.localEulerAngles.z);
|
|
}
|
|
else if (UtilitiesInput.isReelingOut)
|
|
{
|
|
float num4 = pissingParticlesOld.transform.localEulerAngles.x - Time.deltaTime * 80f;
|
|
if (num4 < 330f && num4 > 180f)
|
|
{
|
|
num4 = 330f;
|
|
}
|
|
pissingParticlesOld.transform.localEulerAngles = new Vector3(num4, pissingParticlesOld.transform.localEulerAngles.y, pissingParticlesOld.transform.localEulerAngles.z);
|
|
}
|
|
}
|
|
if (boatSimulator != null && !gameController.oceanLevel && !currentHands.baitWasThrown && !IsSomethingOnBait() && UtilitiesInput.GetButtonDown("BOAT_EXIT"))
|
|
{
|
|
StartCoroutine(EnterBoat(false, boatSimulator));
|
|
}
|
|
if ((currentState == PlayerState.DRIVING_BOAT && VRManager.IsVROn()) || (currentState == PlayerState.ICE_FISHING && VRManager.IsVROn()))
|
|
{
|
|
float num5 = 0.3f;
|
|
Vector3 vector = new Vector3(1f, 0.5f, 1f);
|
|
Vector3 vector2 = new Vector3((!(Mathf.Abs(UtilitiesInput.moveAxis.x) > 0.2f)) ? 0f : (UtilitiesInput.moveAxis.x * Time.deltaTime * num5), (!(Mathf.Abs(UtilitiesInput.lookAxis.x) < 0.5f)) ? 0f : (UtilitiesInput.lookAxis.y * Time.deltaTime * num5), (!(Mathf.Abs(UtilitiesInput.moveAxis.y) > 0.2f)) ? 0f : (UtilitiesInput.moveAxis.y * Time.deltaTime * num5));
|
|
if (currentState == PlayerState.ICE_FISHING)
|
|
{
|
|
vector2.y = 0f;
|
|
}
|
|
else if (!VRManager.Instance.IsVRDriveBoat() || boatSimulator.isKayak || !boatSimulator.vrBoatWheel)
|
|
{
|
|
vector2.x = (vector2.z = 0f);
|
|
}
|
|
ufpsCamera.transform.parent.localPosition += vector2;
|
|
ufpsCamera.transform.parent.localPosition = new Vector3(Mathf.Clamp(ufpsCamera.transform.parent.localPosition.x, 0f - vector.x, vector.x), Mathf.Clamp(ufpsCamera.transform.parent.localPosition.y, 0f - vector.y, vector.y), Mathf.Clamp(ufpsCamera.transform.parent.localPosition.z, 0f - vector.z, vector.z));
|
|
Vector3 localPosition = ufpsCamera.transform.parent.localPosition;
|
|
ovrPlayerController.transform.localPosition = localPosition;
|
|
vrWheelMoveLastPosition = localPosition;
|
|
}
|
|
if (currentState == PlayerState.NORMAL)
|
|
{
|
|
if (isOnIce && !drillingController.Drilling && isHandsCameraVisible)
|
|
{
|
|
if (UtilitiesInput.GetButtonDown("TRY_DRILL") && !Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift))
|
|
{
|
|
if (!isDuringAnimation && currentHands.hasRequiredEquipments)
|
|
{
|
|
if (!GlobalSettings.Instance)
|
|
{
|
|
ChangeState(PlayerState.DRILLING);
|
|
}
|
|
else if (!GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.USE_DRILLER_1).isUnlocked)
|
|
{
|
|
GameController.Instance.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/NO_SKILL"));
|
|
}
|
|
else if (!GlobalSettings.Instance.equipmentManager.FindEquipment(EquipmentObject.EquipmentType.OTHER, "DRILLER_01").isBought)
|
|
{
|
|
GameController.Instance.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/NO_AUGER"));
|
|
}
|
|
else
|
|
{
|
|
ChangeState(PlayerState.DRILLING);
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
Debug.DrawRay(transform.position + ufpsCamera.PositionOffset + new Vector3(0f, -0.5f, 0f), ufpsCamera.transform.forward * 1.7f, Color.yellow);
|
|
RaycastHit hitInfo;
|
|
if (!isDuringAnimation && currentHands.hasRequiredEquipments && Physics.Raycast(transform.position + ufpsCamera.PositionOffset + new Vector3(0f, -0.5f, 0f), ufpsCamera.transform.forward, out hitInfo, 1.7f) && hitInfo.transform.tag == "Hole" && Vector3.Distance(transform.position, hitInfo.collider.GetComponent<Hole>().holeCenter.position) > 1f)
|
|
{
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
gameController.hudManager.cursorChooseHole.SetActive(true);
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("USE_HOLE"))
|
|
{
|
|
gameController.hudManager.cursorChooseHole.SetActive(false);
|
|
drillingController.currentHole = hitInfo.collider.GetComponent<Hole>();
|
|
ChangeState(PlayerState.ICE_FISHING);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
gameController.hudManager.cursorChooseHole.SetActive(false);
|
|
}
|
|
}
|
|
if (boatSimulator != null && UtilitiesInput.GetButtonDown("BOAT_DRIVE"))
|
|
{
|
|
Debug.LogError("DriveBoat FishingPlayer");
|
|
StartCoroutine(DriveBoat(true));
|
|
}
|
|
}
|
|
else if (currentState == PlayerState.DRIVING_BOAT)
|
|
{
|
|
if ((VRManager.Instance.IsControllersInput() && UtilitiesInput.GetButtonDown("BOAT_DRIVE_STOP")) || (!VRManager.Instance.IsControllersInput() && UtilitiesInput.GetButtonDown("BOAT_DRIVE")))
|
|
{
|
|
StartCoroutine(DriveBoat(false));
|
|
if ((bool)boatSimulator.rodStand)
|
|
{
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.TROLLING_01, 1.5f);
|
|
}
|
|
}
|
|
if (!Cursor.visible)
|
|
{
|
|
Vector3 localEulerAngles = ufpsCamera.transform.localEulerAngles;
|
|
if (UtilitiesInput.lookAxis.x != 0f)
|
|
{
|
|
localEulerAngles += new Vector3(0f, UtilitiesInput.lookAxis.x * Time.deltaTime * 200f, 0f) * ((!GlobalSettings.Instance) ? 1f : GlobalSettings.Instance.playerSettings.mouseSensitivity);
|
|
}
|
|
if (UtilitiesInput.lookAxis.y != 0f)
|
|
{
|
|
localEulerAngles -= new Vector3(UtilitiesInput.lookAxis.y * Time.deltaTime * 200f, 0f, 0f) * ((!GlobalSettings.Instance) ? 1f : GlobalSettings.Instance.playerSettings.invertYAxis) * ((!GlobalSettings.Instance) ? 1f : GlobalSettings.Instance.playerSettings.mouseSensitivity);
|
|
}
|
|
float num6 = ((!boatSimulator.isKayak) ? 120f : 150f);
|
|
if (localEulerAngles.y > num6 && localEulerAngles.y < 180f)
|
|
{
|
|
localEulerAngles.y = num6;
|
|
}
|
|
else if (localEulerAngles.y < 360f - num6 && localEulerAngles.y > 180f)
|
|
{
|
|
localEulerAngles.y = 360f - num6;
|
|
}
|
|
if (localEulerAngles.x > boatSimulator.playerDownRotateMax && localEulerAngles.x < 180f)
|
|
{
|
|
localEulerAngles.x = boatSimulator.playerDownRotateMax;
|
|
}
|
|
else if (localEulerAngles.x < 290f && localEulerAngles.x > 180f)
|
|
{
|
|
localEulerAngles.x = 290f;
|
|
}
|
|
localEulerAngles.z = 0f;
|
|
ufpsCamera.transform.localEulerAngles = localEulerAngles;
|
|
}
|
|
}
|
|
else if (currentState == PlayerState.FISHING_NET)
|
|
{
|
|
currentHands.fishingNet.UpdateNetInput();
|
|
}
|
|
else if (currentState == PlayerState.WATCH_FISH)
|
|
{
|
|
SetShowObjectPosition();
|
|
if (UtilitiesInput.lookAxis.x != 0f && currentWatchStyle != Fish.WatchStyle.HANDS && currentWatchStyle != Fish.WatchStyle.BOAT)
|
|
{
|
|
if ((bool)this.fish)
|
|
{
|
|
this.fish.transform.Rotate(0f, 0f, UtilitiesInput.lookAxis.x * Time.deltaTime * 350f);
|
|
}
|
|
else if ((bool)junk)
|
|
{
|
|
junk.transform.Rotate(UtilitiesInput.lookAxis.x * Time.deltaTime * 350f * junk.rotationAxis);
|
|
}
|
|
}
|
|
}
|
|
else if (currentState == PlayerState.DRILLING)
|
|
{
|
|
if (UtilitiesInput.GetButtonDown("TRY_DRILL") && !drillingController.placeChosen && isDrillerReady)
|
|
{
|
|
drillingController.ShowDriller(false);
|
|
ChangeState(PlayerState.NORMAL);
|
|
CameraLookAt(transform.position + transform.forward * 3f + new Vector3(0f, 1.4f, 0f), Vector3.zero, 0.5f);
|
|
gameController.hudManager.UpdateControls();
|
|
return;
|
|
}
|
|
bool flag = drillingController.CanIDrill();
|
|
if (!drillingController.placeChosen)
|
|
{
|
|
drillingController.Auger.FadeDriller(!flag);
|
|
}
|
|
if (!drillingController.placeChosen && UtilitiesInput.GetButtonDown("START_DRILL") && flag && isDrillerReady)
|
|
{
|
|
BlockMouseLook(true);
|
|
Cursor.visible = true;
|
|
Cursor.lockState = CursorLockMode.None;
|
|
gameController.hudManager.drillingIconStart.SetActive(false);
|
|
gameController.hudManager.drillingIconDrill.SetActive(true);
|
|
drillingController.Auger.Position(drillingController.DrillPoint.position);
|
|
drillingController.StartDrilling();
|
|
CameraLookAt(drillingController.DrillPoint.transform, new Vector3(0f, 0.45f, 0f), 0.2f);
|
|
drillingController.placeChosen = true;
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
}
|
|
else if (currentState == PlayerState.ICE_FISHING)
|
|
{
|
|
fishingController.UpdateIceFishing();
|
|
}
|
|
else if (currentState == PlayerState.FISHING)
|
|
{
|
|
fishingController.UpdateFishing();
|
|
}
|
|
if ((bool)currentHands && (bool)currentHands.fishingLine)
|
|
{
|
|
if (currentHands.baitWasThrown)
|
|
{
|
|
currentHands.fishingLine.MakeUpdate();
|
|
return;
|
|
}
|
|
currentHands.currentRope.rate = 0f;
|
|
currentHands.fishingLine.currentTension = 0f;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void CheckFloatDepthInput()
|
|
{
|
|
if (!GlobalSettings.Instance || (!CanChangeEquipment() && (!currentHands.fishingRod || !currentHands.fishingRod.isOnRodStand)) || !currentHands.fishingFloat)
|
|
{
|
|
return;
|
|
}
|
|
if (UtilitiesInput.GetButtonUp("FLOAT_LINE_INCREASE") || UtilitiesInput.GetButtonUp("FLOAT_LINE_DECREASE"))
|
|
{
|
|
currentHands.ChangeFloat();
|
|
return;
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("FLOAT_LINE_INCREASE") || UtilitiesInput.GetButtonDown("FLOAT_LINE_DECREASE"))
|
|
{
|
|
lastFloatDepthInputDown = Time.realtimeSinceStartup;
|
|
}
|
|
if (Time.realtimeSinceStartup - lastFloatDepthInput < floatDepthInputDelay)
|
|
{
|
|
return;
|
|
}
|
|
EquipmentManager equipmentManager = GlobalSettings.Instance.equipmentManager;
|
|
float currentFloatDepth = equipmentManager.currentSetSpecificParameters.currentFloatDepth;
|
|
float num = currentFloatDepth;
|
|
if (UtilitiesInput.GetButton("FLOAT_LINE_INCREASE"))
|
|
{
|
|
if (currentFloatDepth < equipmentManager.maxFloatDepth)
|
|
{
|
|
num = ((!(Time.realtimeSinceStartup - lastFloatDepthInputDown >= fastFloatDepthDelay)) ? (num + 1f) : Mathf.Clamp(num + fastFloatDepthIncrese, equipmentManager.minFloatDepth, equipmentManager.maxFloatDepth));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!UtilitiesInput.GetButton("FLOAT_LINE_DECREASE"))
|
|
{
|
|
return;
|
|
}
|
|
if (currentFloatDepth > equipmentManager.minFloatDepth)
|
|
{
|
|
num = ((!(Time.realtimeSinceStartup - lastFloatDepthInputDown >= fastFloatDepthDelay)) ? (num - 1f) : Mathf.Clamp(num - fastFloatDepthIncrese, equipmentManager.minFloatDepth, equipmentManager.maxFloatDepth));
|
|
}
|
|
}
|
|
lastFloatDepthInput = Time.realtimeSinceStartup;
|
|
equipmentManager.currentSetSpecificParameters.currentFloatDepth = num;
|
|
string text = num + " cm";
|
|
if (GlobalSettings.Instance.playerSettings.imperialUnits)
|
|
{
|
|
text = text + "\n(" + UtilitiesUnits.GetLengthCmString(num) + ")";
|
|
}
|
|
HUDManager.Instance.ShowMessage(Utilities.GetTranslation("GUI/OPTIONS_FLOAT_LENGTH") + ": " + text, 3f);
|
|
}
|
|
|
|
private void LateUpdate()
|
|
{
|
|
if (gameController == null || !gameController.isInitialized || currentHands == null)
|
|
{
|
|
return;
|
|
}
|
|
if (vrLateUpdateHands)
|
|
{
|
|
UpdateVRHands();
|
|
}
|
|
if (((bool)BugReporter.Instance && BugReporter.Instance.isVisible) || gameController.IsQuickMenu() || Time.deltaTime == 0f)
|
|
{
|
|
return;
|
|
}
|
|
UpdateVRHUD();
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
ufpsCameraCamera.fieldOfView = CurrentFieldOfView * ZoomFieldOfView;
|
|
UpdateFOV(false);
|
|
Camera camera = baitIndicatorCamera;
|
|
float fieldOfView = ufpsCameraCamera.fieldOfView;
|
|
ufpsWeaponCamera.fieldOfView = fieldOfView;
|
|
fieldOfView = fieldOfView;
|
|
hunterCamera.fieldOfView = fieldOfView;
|
|
camera.fieldOfView = fieldOfView;
|
|
if (gameController.iceLevel)
|
|
{
|
|
maskCamera.GetComponent<Camera>().fieldOfView = ufpsCameraCamera.fieldOfView;
|
|
}
|
|
if ((bool)postProcessingBehaviour_1)
|
|
{
|
|
if (!GlobalSettings.Instance && CurrentFieldOfView == 100f)
|
|
{
|
|
CurrentFieldOfView = 60f;
|
|
}
|
|
else if ((bool)GlobalSettings.Instance)
|
|
{
|
|
CurrentFieldOfView = GlobalSettings.Instance.renderSettings.fov;
|
|
}
|
|
}
|
|
if (gameController.iceLevel || underwaterCamera.isTurnedOn)
|
|
{
|
|
baitIndicatorCamera.fieldOfView = (CurrentFieldOfView = 60f);
|
|
}
|
|
}
|
|
if (!currentHands.fishingRod.rodMegaAttach || !currentHands.fishingRod.rodMegaAttach.attached)
|
|
{
|
|
return;
|
|
}
|
|
if (currentState == PlayerState.DRILLING)
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
drillingController.DrillPoint.transform.parent = ufpsCamera.transform;
|
|
drillingController.DrillPoint.localPosition = new Vector3(0f, 0.1f, 0.65f);
|
|
}
|
|
if (!drillingController.Drilling)
|
|
{
|
|
drillingController.Auger.Position(drillingController.DrillPoint.position);
|
|
}
|
|
}
|
|
else if (currentState == PlayerState.FISHING_NET)
|
|
{
|
|
currentHands.fishingNet.LateUpdateNetInput();
|
|
}
|
|
else if (currentState == PlayerState.WATCH_FISH)
|
|
{
|
|
if ((bool)fish)
|
|
{
|
|
if (currentWatchStyle == Fish.WatchStyle.HOOK_LIGHT)
|
|
{
|
|
currentHands.UpdateWatchFishLine(currentHands.bait.ropeRigidbody.transform);
|
|
fish.transform.eulerAngles = new Vector3(-90f, fish.transform.eulerAngles.y, fish.transform.eulerAngles.z);
|
|
}
|
|
}
|
|
else if ((bool)junk)
|
|
{
|
|
currentHands.UpdateWatchFishLine(junk.hookPosition);
|
|
}
|
|
if (UtilitiesInput.GetVibration(0) > 0f || UtilitiesInput.GetVibration(1) > 0f)
|
|
{
|
|
UtilitiesInput.StopVibration(true);
|
|
UtilitiesInput.StopVibration(false);
|
|
}
|
|
}
|
|
CheckWater();
|
|
if ((!gameController.iceLevel && currentHands.baitWasThrown) || (gameController.iceLevel && currentHands.bait.isOnWater))
|
|
{
|
|
if (gameController.iceLevel)
|
|
{
|
|
distanceToBait = Vector2.Distance(new Vector2(drillingController.currentHole.transform.position.x, drillingController.currentHole.transform.position.z), new Vector2(currentHands.throwObject.transform.position.x, currentHands.throwObject.transform.position.z));
|
|
}
|
|
else
|
|
{
|
|
distanceToBait = Vector2.Distance(new Vector2(transform.position.x, transform.position.z), new Vector2(currentHands.throwObject.transform.position.x, currentHands.throwObject.transform.position.z));
|
|
}
|
|
gameController.hudManager.hudFishing.UpdateDistance(distanceToBait);
|
|
gameController.hudManager.hudFishing.UpdateDepth(Mathf.Clamp(currentHands.bait.transform.position.y + 0.1f, -666f, 0f));
|
|
gameController.hudManager.hudFishing.UpdateLineLength(currentHands.fishingLine.stretchToDistance, currentHands.fishingLine.currentTension);
|
|
}
|
|
else
|
|
{
|
|
gameController.hudManager.hudFishing.UpdateDistance(0f);
|
|
gameController.hudManager.hudFishing.UpdateDepth(0f);
|
|
gameController.hudManager.hudFishing.UpdateLineLength(0f, 0f);
|
|
}
|
|
if ((bool)fish)
|
|
{
|
|
if (!GlobalSettings.Instance || GlobalSettings.Instance.turnOnMyCheats)
|
|
{
|
|
gameController.hudManager.hudFishing.fishDurability.gameObject.SetActive(true);
|
|
gameController.hudManager.hudFishing.strengthDifferenceSlider.gameObject.SetActive(true);
|
|
}
|
|
gameController.hudManager.hudFishing.UpdateFishDurability(fish.DurabilityCurrentRatio);
|
|
gameController.hudManager.hudFishing.UpdateStrengthDifference(PlayerFishStrengthDiff);
|
|
}
|
|
else
|
|
{
|
|
gameController.hudManager.hudFishing.fishDurability.gameObject.SetActive(false);
|
|
gameController.hudManager.hudFishing.strengthDifferenceSlider.gameObject.SetActive(false);
|
|
}
|
|
if ((bool)boatSimulator && boatSimulator.currentState == BoatSimulator.BoatState.PLAYER_FISHING && checkBoatHeight > 0f)
|
|
{
|
|
RaycastHit hitInfo;
|
|
if (Physics.Raycast(transform.position + transform.up * 0.05f, -transform.up, out hitInfo, checkBoatHeight))
|
|
{
|
|
if (hitInfo.collider.gameObject.layer == LayerMask.NameToLayer("PlayerCollider"))
|
|
{
|
|
Debug.LogError("Boat foot no hit 1");
|
|
SetPosition(boatSimulator.fishingPosition.position);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("Boat foot no hit 2");
|
|
SetPosition(boatSimulator.fishingPosition.position);
|
|
}
|
|
}
|
|
else if (transform.position.y <= -1f && isInWater && !canFallInWater && !isTeleporting)
|
|
{
|
|
SetPosition(prevPosition);
|
|
}
|
|
else
|
|
{
|
|
prevPosition = transform.position;
|
|
}
|
|
if ((bool)boatSimulator && boatSimulator.isKayak && boatSimulator.currentState == BoatSimulator.BoatState.PLAYER_FISHING)
|
|
{
|
|
SetPosition(boatSimulator.fishingPosition.position);
|
|
}
|
|
CalculateFishDistanceBehavior();
|
|
gameController.hudManager.hudFishing.UpdateFishState((!fish || !fish.isFighting) ? string.Empty : "Fish caught");
|
|
gameController.hudManager.hudFishing.UpdateDrag(currentHands.reel.currentDrag * 100f, currentHands.reel.isDragActive);
|
|
gameController.hudManager.hudFishing.UpdateReelSpeed(currentHands.currentUserReelSpeed);
|
|
gameController.hudManager.hudFishing.UpdateReelSpeedNew(currentHands.currentUserReelSpeed);
|
|
gameController.hudManager.hudFishing.UpdateTension(currentHands.fishingLine.GetTension());
|
|
gameController.hudManager.UpdateLuckBar(gameController.junkManager.GetCurrentLuck());
|
|
gameController.hudManager.UpdateDrunkBar(drunkLevel);
|
|
gameController.hudManager.UpdatePissBar(pissingLevel);
|
|
gameController.hudManager.UpdateFoodBar(foodLevel);
|
|
gameController.hudManager.UpdatePooBar(pooLevel);
|
|
gameController.hudManager.UpdateStrengthBar(GetCurrentStrength());
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (currentState != PlayerState.DRIVING_BOAT && currentState == PlayerState.FISHING_NET)
|
|
{
|
|
currentHands.fishingNet.FixedUpdateNetInput();
|
|
}
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (LayerMask.LayerToName(other.gameObject.layer) == "Water")
|
|
{
|
|
isInWater = true;
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
}
|
|
|
|
private void OnTriggerExit(Collider other)
|
|
{
|
|
if (LayerMask.LayerToName(other.gameObject.layer) == "Water")
|
|
{
|
|
isInWater = false;
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
}
|
|
|
|
private void OnCollisionEnter(Collision col)
|
|
{
|
|
}
|
|
|
|
public void ResetPlayer(GameObject spawnPoint)
|
|
{
|
|
currentHands.StopFishing(false);
|
|
ResetFishing();
|
|
ResetJunk();
|
|
if (!boatSimulator)
|
|
{
|
|
SetPosition(spawnPoint.transform.position);
|
|
SetRotation(spawnPoint.transform.eulerAngles);
|
|
}
|
|
if ((bool)fxBlood1)
|
|
{
|
|
fxBlood1.enabled = false;
|
|
}
|
|
if ((bool)gaussianBlur)
|
|
{
|
|
gaussianBlur.enabled = false;
|
|
}
|
|
pissingLevel = 0f;
|
|
pooLevel = 0f;
|
|
foodLevel = 0f;
|
|
drunkLevel = 0f;
|
|
strengthLevel = 0f;
|
|
gameController.fisheryExitCounter = 0;
|
|
if (gameController.iceLevel)
|
|
{
|
|
currentHands.ShowRightArm();
|
|
currentHands.ShowLeftArm();
|
|
currentHands.StopIceFishing();
|
|
drillingController.currentHole = null;
|
|
}
|
|
SitDown(-1f);
|
|
if ((bool)boatSimulator)
|
|
{
|
|
StartCoroutine(DriveBoat(false));
|
|
}
|
|
else
|
|
{
|
|
ChangeState(PlayerState.NORMAL);
|
|
}
|
|
if (gameController.iceLevel)
|
|
{
|
|
fishingController.FinishIceFishing();
|
|
}
|
|
}
|
|
|
|
public void CheckWater()
|
|
{
|
|
if (transform.position.y <= resetPlayerInWater && !gameController.iceLevel)
|
|
{
|
|
AudioController.Play("Footsteps_Water_01", transform);
|
|
StartCoroutine(gameController.ResetPlayer(false));
|
|
return;
|
|
}
|
|
if (waterMaxClipRange > 1000f)
|
|
{
|
|
WaterProjectSettings.Instance.CameraClipRange = Mathf.Lerp(1000f, waterMaxClipRange, (ufpsCamera.transform.position.y - 20f) / 50f);
|
|
}
|
|
if (gameController.endlessWaterArea)
|
|
{
|
|
bool flag = !boatSimulator && transform.position.y < 0f;
|
|
if (flag != isInWater)
|
|
{
|
|
isInWater = flag;
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
}
|
|
if (!gameController.allowFishing || gameController.iceLevel)
|
|
{
|
|
return;
|
|
}
|
|
bool flag2 = true;
|
|
if ((ufpsCamera.transform.localEulerAngles.x > 180f && ufpsCamera.transform.localEulerAngles.x < 320f) || (ufpsCamera.transform.localEulerAngles.x < 180f && ufpsCamera.transform.localEulerAngles.x > 10f))
|
|
{
|
|
flag2 = false;
|
|
}
|
|
else
|
|
{
|
|
Debug.DrawRay(transform.position + ufpsCamera.PositionOffset, transform.forward * checkWaterDistance, Color.yellow);
|
|
RaycastHit hitInfo;
|
|
if (Physics.Raycast(transform.position + ufpsCamera.PositionOffset, transform.forward, out hitInfo, checkWaterDistance, checkWaterMask))
|
|
{
|
|
flag2 = false;
|
|
}
|
|
else
|
|
{
|
|
Debug.DrawRay(transform.position + ufpsCamera.PositionOffset + transform.forward * checkWaterDistance, -Vector3.up * 500f, Color.blue);
|
|
RaycastHit hitInfo2;
|
|
if (Physics.Raycast(transform.position + ufpsCamera.PositionOffset + transform.forward * checkWaterDistance, -Vector3.up, out hitInfo2, 500f, checkWaterMask))
|
|
{
|
|
flag2 = ((!gameController.endlessWaterArea) ? (LayerMask.LayerToName(hitInfo2.collider.gameObject.layer) == "Water") : (hitInfo2.point.y < 0f));
|
|
}
|
|
}
|
|
}
|
|
if (flag2 && !TutorialManager.Instance.throwNearTutorial.wasShown)
|
|
{
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.THROW_NEAR_01);
|
|
}
|
|
else if (flag2 && !TutorialManager.Instance.throwFlyTutorial.wasShown && currentHands.isFlyRig && !VRManager.IsVROn())
|
|
{
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.FLY_FISHING_01);
|
|
}
|
|
bool flag3 = (!(ufpsCamera.transform.localEulerAngles.x > 180f) || !(ufpsCamera.transform.localEulerAngles.x < 320f)) && (!(ufpsCamera.transform.localEulerAngles.x < 180f) || !(ufpsCamera.transform.localEulerAngles.x > 10f));
|
|
flag2 = (flag3 = true);
|
|
if (fishingController.canThrowNear != flag3)
|
|
{
|
|
fishingController.canThrowNear = flag3;
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
if (flag2)
|
|
{
|
|
if (currentState == PlayerState.NORMAL)
|
|
{
|
|
ChangeState(PlayerState.FISHING);
|
|
}
|
|
}
|
|
else if (currentState == PlayerState.FISHING && ufpsInput.AllowGameplayInput && !currentHands.baitWasThrown)
|
|
{
|
|
ChangeState(PlayerState.NORMAL);
|
|
}
|
|
CheckVRCameraHeight();
|
|
}
|
|
|
|
public void CheckIsOnIce()
|
|
{
|
|
RaycastHit hitInfo;
|
|
if (Physics.Raycast(transform.position + transform.up * 0.05f, -transform.up, out hitInfo, 10f))
|
|
{
|
|
isOnIce = hitInfo.collider.gameObject.HasTag("ICE_DRILL");
|
|
}
|
|
else
|
|
{
|
|
isOnIce = false;
|
|
}
|
|
}
|
|
|
|
public void ShowCrosshair(bool show)
|
|
{
|
|
ufpsPlayerEventHandler.Crosshair.Set((!show) ? defaultCrosshair : null);
|
|
}
|
|
|
|
public void Pause(bool pause)
|
|
{
|
|
if (!(ufpsInput == null) && !(ufpsWeapon == null))
|
|
{
|
|
if (pause)
|
|
{
|
|
AllowGameplayInput = ufpsInput.AllowGameplayInput;
|
|
MouseLookSensitivity = ufpsInput.MouseLookSensitivity;
|
|
RotationSpringStiffness = ufpsWeapon.RotationSpringStiffness;
|
|
RotationSpringDamping = ufpsWeapon.RotationSpringDamping;
|
|
ufpsInput.AllowGameplayInput = false;
|
|
ufpsInput.MouseLookSensitivity = new Vector2(0f, 0f);
|
|
ufpsWeapon.RotationSpringStiffness = 1f;
|
|
ufpsWeapon.RotationSpringDamping = 1f;
|
|
}
|
|
else if (MouseLookSensitivity.x >= 0f)
|
|
{
|
|
ufpsInput.AllowGameplayInput = AllowGameplayInput;
|
|
ufpsInput.MouseLookSensitivity = MouseLookSensitivity;
|
|
ufpsWeapon.RotationSpringStiffness = RotationSpringStiffness;
|
|
ufpsWeapon.RotationSpringDamping = RotationSpringDamping;
|
|
RefreshInputSettings();
|
|
}
|
|
ufpsWeapon.Refresh();
|
|
}
|
|
}
|
|
|
|
public void ChangeState(PlayerState newState)
|
|
{
|
|
gameController.hudManager.cursorChooseHole.SetActive(false);
|
|
if (newState != PlayerState.DRIVING_BOAT)
|
|
{
|
|
UtilitiesInput.StopVibration();
|
|
}
|
|
switch (newState)
|
|
{
|
|
case PlayerState.NORMAL:
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.NORMAL);
|
|
if ((bool)currentHands)
|
|
{
|
|
if ((currentHands.baitWasThrown && !currentHands.fishingRod.isOnRodStand) || currentState == PlayerState.WATCH_FISH || currentState == PlayerState.ICE_FISHING)
|
|
{
|
|
fishingController.FinishFishing();
|
|
}
|
|
if (currentState == PlayerState.FISHING_NET)
|
|
{
|
|
currentHands.fishingNet.HideNet();
|
|
}
|
|
}
|
|
if (currentState == PlayerState.ICE_FISHING)
|
|
{
|
|
drillingController.currentHole.GetComponent<CapsuleCollider>().enabled = true;
|
|
if ((bool)drillingController.currentHole.aroundHoleCollider)
|
|
{
|
|
drillingController.currentHole.aroundHoleCollider.enabled = true;
|
|
}
|
|
drillingController.currentHole = null;
|
|
drillingController.placeChosen = false;
|
|
characteController.radius = 0.45f;
|
|
SitDown(-1f);
|
|
}
|
|
else if (currentState == PlayerState.DRILLING)
|
|
{
|
|
drillingController.placeChosen = false;
|
|
currentHands.ShowWalkingDriller(true);
|
|
}
|
|
else if (currentState == PlayerState.FISHING_NET)
|
|
{
|
|
SitDown(-1f);
|
|
}
|
|
allowRun = true;
|
|
ufpsInput.AllowGameplayInput = true;
|
|
BlockMouseLook(false);
|
|
AllowInteraction(true);
|
|
Cursor.visible = false;
|
|
Cursor.lockState = CursorLockMode.Locked;
|
|
SetHorizontalRotationLimit(-360f, 360f);
|
|
break;
|
|
case PlayerState.FISHING:
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.FISHING);
|
|
if (currentState == PlayerState.FISHING_NET)
|
|
{
|
|
currentHands.fishingNet.HideNet();
|
|
}
|
|
break;
|
|
case PlayerState.FISHING_NET:
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.FISHING_NET);
|
|
currentHands.reel.rotationAudioObject.Pause();
|
|
currentHands.reel.spoolAudioObject.Pause();
|
|
currentHands.fishingNet.ShowNet();
|
|
ufpsController.Stop();
|
|
ufpsInput.AllowGameplayInput = false;
|
|
BlockMouseLook(true);
|
|
AllowInteraction(false);
|
|
allowRun = false;
|
|
break;
|
|
case PlayerState.DRIVING_BOAT:
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.DRIVING_BOAT);
|
|
ufpsInput.AllowGameplayInput = false;
|
|
BlockMouseLook(true);
|
|
AllowInteraction(false);
|
|
allowRun = false;
|
|
break;
|
|
case PlayerState.WATCH_FISH:
|
|
currentHands.StopFishing(false);
|
|
if (currentState == PlayerState.FISHING_NET)
|
|
{
|
|
currentHands.fishingNet.HideNet();
|
|
}
|
|
Zoom(false, 0.7f);
|
|
if ((bool)fish)
|
|
{
|
|
gameController.hudManager.PlayerCaughtFish(fish);
|
|
}
|
|
else if ((bool)junk)
|
|
{
|
|
gameController.hudManager.PlayerCaughtJunk(junk);
|
|
}
|
|
if (gameController.iceLevel)
|
|
{
|
|
}
|
|
if (currentState == PlayerState.FISHING_NET && (!boatSimulator || !boatSimulator.isKayak))
|
|
{
|
|
SitDown(-1f);
|
|
}
|
|
ufpsController.Stop();
|
|
ufpsInput.AllowGameplayInput = false;
|
|
BlockMouseLook(true);
|
|
AllowInteraction(false);
|
|
TurnOnSpring(false);
|
|
allowRun = false;
|
|
Cursor.visible = true;
|
|
Cursor.lockState = CursorLockMode.None;
|
|
break;
|
|
case PlayerState.DRILLING:
|
|
ufpsController.Stop();
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.DRILLING);
|
|
ufpsInput.AllowGameplayInput = false;
|
|
ufpsInput.MouseLookSensitivity = new Vector2(3f, 0f);
|
|
AllowInteraction(false);
|
|
allowRun = false;
|
|
Cursor.visible = false;
|
|
Cursor.lockState = CursorLockMode.Locked;
|
|
gameController.hudManager.drillingIconStart.SetActive(true);
|
|
gameController.hudManager.drillingIconDrill.SetActive(false);
|
|
currentHands.ShowWalkingDriller(false);
|
|
isDrillerReady = false;
|
|
drillingController.ShowDriller(true);
|
|
CameraLookAt(drillingController.DrillPoint.transform, new Vector3(0f, 0.45f, 0f), 0.5f);
|
|
LeanTween.delayedCall(0.6f, (Action)delegate
|
|
{
|
|
isDrillerReady = true;
|
|
});
|
|
break;
|
|
case PlayerState.ICE_FISHING:
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.ICE_FISHING_01, 3f);
|
|
ufpsController.Stop();
|
|
characteController.radius = 0.05f;
|
|
drillingController.currentHole.GetComponent<CapsuleCollider>().enabled = false;
|
|
if (currentState != PlayerState.WATCH_FISH)
|
|
{
|
|
SitDown(1f);
|
|
}
|
|
currentHands.transform.localRotation = Quaternion.identity;
|
|
if (VRManager.Instance.IsControllersInput())
|
|
{
|
|
currentHands.transform.localPosition = Vector3.zero;
|
|
}
|
|
else
|
|
{
|
|
currentHands.transform.localPosition = new Vector3(0f, Mathf.Lerp(-0.35f, 0f, 0.6f), Mathf.Lerp(-0.2f, 0f, 0.6f));
|
|
}
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.ICE_FISHING);
|
|
gameController.hudManager.ShowHudFishing(true);
|
|
currentHands.StartIceFishing();
|
|
allowRun = false;
|
|
ufpsInput.AllowGameplayInput = false;
|
|
BlockMouseLook(true);
|
|
AllowInteraction(false);
|
|
TurnOnSpring(false);
|
|
Cursor.visible = false;
|
|
Cursor.lockState = CursorLockMode.Locked;
|
|
currentHands.ShowWalkingDriller(false);
|
|
ResetFishing();
|
|
currentHands.baitWasThrown = true;
|
|
break;
|
|
case PlayerState.ATTRACTOR:
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.ATTRACTOR);
|
|
AllowInteraction(false);
|
|
break;
|
|
}
|
|
gameController.hudManager.ShowPullFishCursor(false);
|
|
gameController.hudManager.ShowNetFishCursor(false);
|
|
currentState = newState;
|
|
if ((bool)fishingPlayerRemote)
|
|
{
|
|
fishingPlayerRemote.StateChanged();
|
|
}
|
|
}
|
|
|
|
public bool IsCurrentHands(FishingHands fishingHands)
|
|
{
|
|
return fishingHands == currentHands;
|
|
}
|
|
|
|
public bool IsFishOnCurrentRod()
|
|
{
|
|
return (bool)fish && fish.storedBait.fishingHands == currentHands;
|
|
}
|
|
|
|
[Button]
|
|
public void FloatRopeTest()
|
|
{
|
|
allFishingHands[0].floatRopeDepth = (float)(Mathf.RoundToInt(allFishingHands[0].floatRopeDepth * 100f) + 1) * 0.01f;
|
|
ChangeHands(0);
|
|
}
|
|
|
|
[Button]
|
|
public void ChangeHands0()
|
|
{
|
|
ChangeHands(0);
|
|
}
|
|
|
|
[Button]
|
|
public void ChangeHands1()
|
|
{
|
|
ChangeHands(1);
|
|
}
|
|
|
|
[Button]
|
|
public void ChangeHands2()
|
|
{
|
|
ChangeHands(2);
|
|
}
|
|
|
|
[Button]
|
|
public void ChangeHands3()
|
|
{
|
|
ChangeHands(3);
|
|
}
|
|
|
|
public void ChangeHands(int id)
|
|
{
|
|
if (id >= allFishingHands.Count)
|
|
{
|
|
Debug.LogError("Not enough fishing hands");
|
|
}
|
|
else if (!currentHands || !currentHands.baitWasThrown || currentHands.fishingRod.isOnRodStand)
|
|
{
|
|
FishingHands fishingHands = allFishingHands[id];
|
|
if ((bool)currentHands && !currentHands.fishingRod.isOnRodStand)
|
|
{
|
|
currentHands.gameObject.SetActive(false);
|
|
currentHands.ParentAllObjects();
|
|
}
|
|
bool flag = false;
|
|
if ((bool)currentHands && currentHands.flashLight.enabled)
|
|
{
|
|
flag = true;
|
|
currentHands.flashLight.enabled = false;
|
|
}
|
|
fishingHands.gameObject.SetActive(true);
|
|
currentHands = null;
|
|
fishingHands.ChangeEquipment();
|
|
fishingHands.ChangeRod();
|
|
fishingHands.PrepareNewHands();
|
|
fishingHands.flashLight.enabled = flag;
|
|
floatCamera.TurnOn(false);
|
|
}
|
|
}
|
|
|
|
public void ChangeHandsRodStand(FishingHands newHands)
|
|
{
|
|
if (!currentHands.fishingRod.isOnRodStand)
|
|
{
|
|
currentHands.gameObject.SetActive(false);
|
|
currentHands.ParentAllObjects();
|
|
}
|
|
newHands.flashLight.enabled = currentHands.flashLight.enabled;
|
|
currentHands.flashLight.enabled = false;
|
|
newHands.gameObject.SetActive(true);
|
|
currentHands = newHands;
|
|
fishingController.fishingHands = newHands;
|
|
floatCamera.TurnOn(newHands.isFloatRig);
|
|
}
|
|
|
|
public void RefreshWeatherSettings()
|
|
{
|
|
UniStormWeatherSystem_C uniStormWeatherSystem_C = ((!gameController) ? null : gameController.uniStormSystem);
|
|
if (uniStormWeatherSystem_C != null)
|
|
{
|
|
uniStormWeatherSystem_C.cameraObject = unistormCamera;
|
|
uniStormWeatherSystem_C.rain = rain;
|
|
uniStormWeatherSystem_C.snow = snow;
|
|
uniStormWeatherSystem_C.butterflies = lightningBugs;
|
|
uniStormWeatherSystem_C.rainMist = rainMist;
|
|
uniStormWeatherSystem_C.rainSplashes = rainSplash;
|
|
uniStormWeatherSystem_C.lightningSpawn = lightningPosition;
|
|
uniStormWeatherSystem_C.snowMistFog = snowDust;
|
|
uniStormWeatherSystem_C.mistFog = rainStreaks;
|
|
uniStormWeatherSystem_C.windyLeaves = windyLeaves;
|
|
uniStormWeatherSystem_C.lightningBolt1 = lightningBolt1;
|
|
GameObject gameObject = GameObject.Find("SunGlow");
|
|
if ((bool)gameObject)
|
|
{
|
|
SunShafts component = unistormCamera.GetComponent<SunShafts>();
|
|
component.sunTransform = gameObject.transform;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ResetJunk()
|
|
{
|
|
if ((bool)junk)
|
|
{
|
|
UnityEngine.Object.Destroy(junk.gameObject);
|
|
junk = null;
|
|
}
|
|
}
|
|
|
|
public void ResetFishing(bool breakFish = true)
|
|
{
|
|
UtilitiesInput.StopVibration();
|
|
if ((bool)fish && breakFish && fish.storedBait.fishingHands == currentHands)
|
|
{
|
|
fish.BreakFree();
|
|
fish = null;
|
|
pullForce = 0f;
|
|
}
|
|
if (breakFish)
|
|
{
|
|
ResetJunk();
|
|
}
|
|
if ((bool)currentHands.fishingFloat)
|
|
{
|
|
currentHands.fishingFloat.ResetFloat();
|
|
}
|
|
currentHands.bait.ResetBait();
|
|
currentHands.bait.HasAnyBaitParts();
|
|
if ((bool)currentHands.biteIndicator)
|
|
{
|
|
currentHands.biteIndicator.StopIndicating();
|
|
}
|
|
currentHands.ChangeRopesRadius(false);
|
|
currentHands.ResetJerkBlend();
|
|
currentHands.fishingRod.UpdateBaitDistance();
|
|
currentHands.fishingRod.ChangeBendWarpPosition(true);
|
|
currentHands.reel.ResetReel();
|
|
currentHands.spinningMethodController.Reset();
|
|
currentHands.isThrowing = false;
|
|
currentHands.isThrowingNear = false;
|
|
currentHands.ResetThrowFakeObject();
|
|
if ((bool)currentHands.biteIndicator)
|
|
{
|
|
currentHands.biteIndicator.StopFishing();
|
|
}
|
|
if ((bool)currentHands.feeder)
|
|
{
|
|
currentHands.feeder.PulledFromWater();
|
|
}
|
|
fishingController.throwStrength = fishingController.throwStrengthMin;
|
|
fishingController.fishCanBePulled = false;
|
|
fishingController.fishCanBePulledNet = false;
|
|
fishingController.isCastingFly = false;
|
|
fishingController.fishInNetAreaTimer = 0f;
|
|
gameController.ShowFishEscapeColliders(true);
|
|
gameController.hudManager.hudFishing.UpdateThrowStrength(0f);
|
|
gameController.hudManager.hudFishing.ShowThrowSlider(false);
|
|
gameController.hudManager.hudFishing.ShowFlyCastSlider(false);
|
|
gameController.hudManager.hudFishing.fishDurability.gameObject.SetActive(false);
|
|
gameController.hudManager.hudFishing.StartTensionAlarm(false);
|
|
gameController.hudManager.ShowPullFishCursor(false);
|
|
gameController.hudManager.ShowNetFishCursor(false);
|
|
if (!gameController.iceLevel)
|
|
{
|
|
gameController.hudManager.ShowHudFishing(false);
|
|
}
|
|
if (!gameController.iceLevel)
|
|
{
|
|
LeanTween.value(0f, 1f, (!currentHands.baitWasThrown) ? 0f : 0.25f).setOnComplete((Action)delegate
|
|
{
|
|
currentHands.fishingRod.ShowReelLine(false);
|
|
});
|
|
ufpsInput.AllowGameplayInput = true;
|
|
BlockMouseLook(false);
|
|
AllowInteraction(true);
|
|
TurnOnSpring(true);
|
|
currentHands.baitWasThrown = false;
|
|
if ((bool)fishingPlayerRemote)
|
|
{
|
|
fishingPlayerRemote.StateChanged();
|
|
}
|
|
allowRun = true;
|
|
ufpsController.MotorAcceleration = (currentMotorAcceleration = motorAccelerationValues.x);
|
|
}
|
|
SetHorizontalRotationLimit(-360f, 360f);
|
|
if (!gameController.iceLevel)
|
|
{
|
|
if ((bool)currentHands.fishingFloat)
|
|
{
|
|
Utilities.SetLayerRecursively(currentHands.fishingFloat.gameObject, "Weapon");
|
|
}
|
|
if ((bool)currentHands.feeder)
|
|
{
|
|
Utilities.SetLayerRecursively(currentHands.feeder.gameObject, "Weapon");
|
|
}
|
|
currentHands.bait.UpdateLayers("Weapon", false);
|
|
}
|
|
gameController.junkManager.ResetJunk();
|
|
StartCoroutine(underwaterCamera.TurnOn(false, true));
|
|
currentHands.currentRope.rate = 0f;
|
|
currentHands.currentRope.transform.parent = GameController.Instance.transform;
|
|
if (gameController.iceLevel)
|
|
{
|
|
currentHands.currentRope.getSegmentProperties().length = 0.2f;
|
|
}
|
|
currentHands.currentRope.regenerateRope(false);
|
|
if (currentHands.isFlyRig)
|
|
{
|
|
LeanTween.delayedCall(0.1f, (Action)delegate
|
|
{
|
|
currentHands.currentRope.regenerateRope(false);
|
|
});
|
|
}
|
|
if ((bool)currentHands.fishingFloat)
|
|
{
|
|
currentHands.floatRope.transform.parent = GameController.Instance.transform;
|
|
currentHands.floatRope.regenerateRope(false);
|
|
currentHands.fishingPlayer.floatCamera.TurnOn(false);
|
|
}
|
|
LeanTween.delayedCall(1f, (Action)delegate
|
|
{
|
|
});
|
|
currentHands.fishingLine.tryPullTension = 0f;
|
|
currentHands.fishingLine.currentTryReelTension = 0f;
|
|
currentHands.fishingLine.pumpTension = 0f;
|
|
currentHands.fishingLine.currentPumpTension = 0f;
|
|
currentHands.fishingLine.breakTensionTimer = 3f;
|
|
if ((bool)boatSimulator)
|
|
{
|
|
boatSimulator.PauseFloating(false);
|
|
}
|
|
if (VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
currentHands.HideLeftArm();
|
|
}
|
|
currentHands.fishingLine.UpdateSegmentsDamping();
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
|
|
[Button]
|
|
public void LineBreak()
|
|
{
|
|
GameController.Instance.fishingPlayer.LineBreak(Utilities.GetTranslation("HUD_MESSAGE/LINE_BROKE_TENSION"), 0f);
|
|
}
|
|
|
|
public void LineBreak(string msg, float loseBaitChance)
|
|
{
|
|
if (gameController.fishingPlayer.currentHands.fishingNet.gameObject.activeInHierarchy)
|
|
{
|
|
Debug.LogError("Line NOT Break NET msg: " + msg);
|
|
}
|
|
else if (currentState == PlayerState.WATCH_FISH || ((bool)fish && fish.isWatchingFish))
|
|
{
|
|
currentHands.currentRope.regenerateRope(true);
|
|
Debug.LogError("Line NOT Break WATCH_FISH msg: " + msg);
|
|
}
|
|
else if ((!fish || !(fish.transform.parent == null)) && (!junk || !(junk.transform.parent == null)))
|
|
{
|
|
bool flag = false;
|
|
gameController.hudManager.ShowMessage(string.Empty + msg + ((!flag) ? string.Empty : ("\n" + Utilities.GetTranslation("HUD_MESSAGE/BAIT_LOST"))));
|
|
if (gameController.iceLevel)
|
|
{
|
|
ResetFishing();
|
|
}
|
|
else
|
|
{
|
|
ChangeState(PlayerState.NORMAL);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void OnCatchBait(Fish f, FishingHands hands)
|
|
{
|
|
if (f != null && fish != null)
|
|
{
|
|
Debug.LogError("OnCatchBait 2 fish");
|
|
return;
|
|
}
|
|
fish = f;
|
|
if ((bool)fishingPlayerRemote)
|
|
{
|
|
fishingPlayerRemote.StateChanged();
|
|
}
|
|
hands.bait.baitAnimation.ResetMovingParts(true);
|
|
if (!hands.fishingFloat && !hands.isGroundRig)
|
|
{
|
|
hands.bait.SetFish(fish);
|
|
}
|
|
if ((bool)hands.biteIndicator)
|
|
{
|
|
hands.biteIndicator.StartIndicating();
|
|
}
|
|
if ((hands.isGroundRig || hands.fishingRod.isOnRodStand) && !boatSimulator)
|
|
{
|
|
hands.fishingRod.ChangeBendWarpPosition(false);
|
|
}
|
|
hands.bait.rigidbody.isKinematic = true;
|
|
hands.bait.rigidbody.useGravity = false;
|
|
hands.bait.baitAnimation.StopAnimation();
|
|
if (!VRManager.Instance.IsVRReeling() && !hands.fishingFloat && !hands.isGroundRig && hands.currentUserReelSpeed < 0.5f)
|
|
{
|
|
hands.currentUserReelSpeed = 0.5f;
|
|
}
|
|
if ((bool)hands.fishingFloat)
|
|
{
|
|
hands.bait.transform.parent = GameController.Instance.transform;
|
|
hands.floatRope.transform.parent = GameController.Instance.transform;
|
|
}
|
|
if (gameController.iceLevel)
|
|
{
|
|
hands.currentRope.getSegmentProperties().length = 0.75f;
|
|
hands.currentRope.regenerateRope(true);
|
|
}
|
|
pullForce = 0f;
|
|
if (!hands.fishingFloat)
|
|
{
|
|
}
|
|
if (!GlobalSettings.Instance || GlobalSettings.Instance.turnOnMyCheats)
|
|
{
|
|
gameController.hudManager.hudFishing.fishDurability.gameObject.SetActive(true);
|
|
gameController.hudManager.hudFishing.strengthDifferenceSlider.gameObject.SetActive(true);
|
|
}
|
|
gameController.hudManager.hudFishing.InitStrengthDifference(fish);
|
|
hands.spinningMethodController.Reset();
|
|
if (!underwaterCamera.isTurnedOn || !hands.fishingFloat)
|
|
{
|
|
}
|
|
float num = Mathf.Clamp(fish.Length, 0f, 3f);
|
|
if ((bool)hands.fishingFloat || hands.isGroundRig)
|
|
{
|
|
underwaterCamera.SetDistanceAway(num * 0.6f, 2f);
|
|
}
|
|
else
|
|
{
|
|
underwaterCamera.SetDistanceAway(num * 1.5f, 1f);
|
|
}
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.STRIKE_01, 1.5f);
|
|
}
|
|
|
|
public void OnCatchJunk(Junk newJunk)
|
|
{
|
|
junk = newJunk;
|
|
junk.transform.parent = currentHands.bait.catchPosition;
|
|
junk.transform.localEulerAngles = new Vector3(-90f, 0f, 0f);
|
|
junk.transform.localPosition = new Vector3(0f - junk.hookPosition.localPosition.x, 0f - junk.hookPosition.localPosition.z, junk.hookPosition.localPosition.y);
|
|
currentHands.bait.baitAnimation.ResetMovingParts(true);
|
|
currentHands.bait.SetJunk(junk);
|
|
currentHands.bait.baitAnimation.StopAnimation();
|
|
currentHands.spinningMethodController.Reset();
|
|
}
|
|
|
|
public void FishCatch(Fish netFish = null)
|
|
{
|
|
if (fish == null)
|
|
{
|
|
Debug.LogError("FishCatch fish == null");
|
|
}
|
|
else if (!fish.isWatchingFish || gameController.iceLevel)
|
|
{
|
|
fish.isWatchingFish = true;
|
|
fish.CheckBehaviorDistance();
|
|
fish.isInNetArea = false;
|
|
fish.isOnGround = false;
|
|
fish.particleSwim.Stop();
|
|
fish.animController.ChangeAnimation(FishAnimationController.AnimType.WATCH);
|
|
fish.stateIndicator.gameObject.SetActive(false);
|
|
fish.DisableAI();
|
|
fish.pullOutPosition = fish.transform.position;
|
|
if ((bool)netFish && fish != netFish)
|
|
{
|
|
Debug.LogError("Wrong fish?");
|
|
}
|
|
if ((bool)netFish && !fish)
|
|
{
|
|
fish = netFish;
|
|
}
|
|
Debug.Log("!!! FISH CATCH !!! " + fish.fishName);
|
|
if (gameController.isMultiplayer)
|
|
{
|
|
MultiplayerManager.Instance.multiplayerChat.SendFish(fish);
|
|
}
|
|
if (gameController.isTournament)
|
|
{
|
|
tournamentPlayer.CatchFish(fish);
|
|
}
|
|
if ((bool)GlobalTournamentManager.Instance)
|
|
{
|
|
GlobalTournamentManager.Instance.FishCaught(fish);
|
|
}
|
|
StartCoroutine(ShowCatchObject());
|
|
}
|
|
}
|
|
|
|
public IEnumerator ShowCatchObject()
|
|
{
|
|
GameObject showObject = ((!fish) ? junk.gameObject : fish.gameObject);
|
|
if (showObject == null || currentHands == null || showObject.transform.parent == currentHands.transform || showObject.transform.parent == null || showObject.transform.parent == currentHands.fishingNet.transform || currentHands.animator.GetBool("WatchFish"))
|
|
{
|
|
yield break;
|
|
}
|
|
if (VRManager.IsVROn())
|
|
{
|
|
HUDManager.Instance.ShowHudFishing(false);
|
|
}
|
|
if (gameController.iceLevel)
|
|
{
|
|
currentHands.transform.localPosition = Vector3.zero;
|
|
currentHands.transform.localRotation = Quaternion.identity;
|
|
Vector3 position = currentHands.watchFishPosition.position;
|
|
position.x = drillingController.currentHole.Data.Position.x;
|
|
position.z = drillingController.currentHole.Data.Position.z;
|
|
currentHands.watchFishPosition.position = position;
|
|
}
|
|
if (fish.watchStyle == Fish.WatchStyle.BOAT)
|
|
{
|
|
if ((bool)boatSimulator)
|
|
{
|
|
if (underwaterCamera.isTurnedOn)
|
|
{
|
|
StartCoroutine(underwaterCamera.TurnOn(false));
|
|
}
|
|
else
|
|
{
|
|
gameController.hudManager.FadeDark(1f, 0.3f);
|
|
}
|
|
yield return new WaitForSeconds(0.3f);
|
|
}
|
|
else
|
|
{
|
|
fish.watchStyle = Fish.WatchStyle.HANDS;
|
|
}
|
|
}
|
|
if (fish.watchStyle == Fish.WatchStyle.HANDS && VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
gameController.hudManager.FadeDark(1f, 0.3f);
|
|
yield return new WaitForSeconds(0.3f);
|
|
}
|
|
Debug.Log("ShowCatchObject " + fish.watchStyle);
|
|
if ((bool)fish)
|
|
{
|
|
fish.particleSwim.Stop();
|
|
}
|
|
currentWatchStyle = (fish ? fish.watchStyle : Fish.WatchStyle.HOOK_LIGHT);
|
|
showObject.transform.SetParent(null);
|
|
if (currentWatchStyle != Fish.WatchStyle.HOOK_LIGHT && currentWatchStyle == Fish.WatchStyle.HANDS)
|
|
{
|
|
currentHands.fishingNet.MoveFishToCatchPosition(showObject);
|
|
currentHands.bait.ResetBait();
|
|
currentHands.bait.rigidbody.isKinematic = true;
|
|
}
|
|
if (!VRManager.Instance.IsControllersInput())
|
|
{
|
|
currentHands.animator.SetBool("WatchFish", true);
|
|
}
|
|
gameController.hudManager.hudWatchFish.UpdateWatchFishPosition(currentWatchStyle);
|
|
if (currentWatchStyle != Fish.WatchStyle.BOAT)
|
|
{
|
|
StartCoroutine(underwaterCamera.TurnOn(false));
|
|
}
|
|
if (currentWatchStyle == Fish.WatchStyle.HOOK_LIGHT)
|
|
{
|
|
currentHands.ShowWatchFishRopes();
|
|
}
|
|
else
|
|
{
|
|
currentHands.ShowRopes(false);
|
|
}
|
|
if (gameController.iceLevel)
|
|
{
|
|
LeanTween.delayedCall(0f, currentHands.HideLeftArm);
|
|
}
|
|
if (currentWatchStyle == Fish.WatchStyle.HOOK_LIGHT)
|
|
{
|
|
if (!gameController.iceLevel)
|
|
{
|
|
ufpsCamera.SetRotation(ufpsCamera.Transform.eulerAngles, false);
|
|
Quaternion quaternion = Quaternion.LookRotation(showObject.transform.position - ufpsCamera.transform.position);
|
|
Vector2 to = new Vector2(quaternion.eulerAngles.x, quaternion.eulerAngles.y);
|
|
if (currentWatchStyle == Fish.WatchStyle.HANDS)
|
|
{
|
|
to.x = 30f;
|
|
}
|
|
else
|
|
{
|
|
to.x = 0f;
|
|
}
|
|
LeanTween.value(base.gameObject, delegate(Vector2 v)
|
|
{
|
|
ufpsCamera.Angle = v;
|
|
}, ufpsCamera.Angle, to, 0.3f).setEase(LeanTweenType.easeInOutQuad);
|
|
}
|
|
yield return new WaitForSeconds(0.2f);
|
|
showObject.transform.SetParent(currentHands.transform);
|
|
}
|
|
if ((bool)fish)
|
|
{
|
|
fish.particleSwim.Stop();
|
|
}
|
|
if (!VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
currentHands.animator.SetInteger("WatchStyle", (int)currentWatchStyle);
|
|
}
|
|
else
|
|
{
|
|
currentHands.leftArm.SetActive(false);
|
|
}
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.WATCH_FISH);
|
|
ChangeState(PlayerState.WATCH_FISH);
|
|
if (currentWatchStyle == Fish.WatchStyle.HANDS)
|
|
{
|
|
currentHands.HideRod();
|
|
currentHands.ActivateRopes(false);
|
|
}
|
|
currentHands.bait.ropeRigidbody.transform.localEulerAngles = Vector3.zero;
|
|
pullForce = 0f;
|
|
LeanTween.delayedCall(0.1f, (Action)delegate
|
|
{
|
|
currentHands.fishingRod.ResetBend();
|
|
if (currentWatchStyle == Fish.WatchStyle.HANDS && VRManager.Instance.IsControllersInput())
|
|
{
|
|
currentHands.HideRightArm();
|
|
}
|
|
});
|
|
currentHands.currentRope.regenerateRope(false);
|
|
if ((bool)fish)
|
|
{
|
|
fish.animController.squirmTimer = UnityEngine.Random.Range(5f, 8f);
|
|
}
|
|
AudioController.Play("SplashOut_01", showObject.transform.position);
|
|
WaterSplash(1f);
|
|
if (Vector3.Distance(currentHands.leftArmReelParent.transform.localPosition, currentHands.leftArmReelParentStartPos) > 0.05f)
|
|
{
|
|
currentHands.leftArmReelParent.transform.localPosition = currentHands.leftArmReelParentStartPos;
|
|
Debug.Log("Wrong ReelArmParent pos 1");
|
|
}
|
|
float pullOutTime = 0.4f;
|
|
if (currentWatchStyle == Fish.WatchStyle.BOAT && (bool)fish && (bool)boatSimulator)
|
|
{
|
|
if ((bool)boatSimulator)
|
|
{
|
|
fish.animController.ChangeAnimation(FishAnimationController.AnimType.WATCH);
|
|
boatSimulator.PauseFloating(true);
|
|
if (boatSimulator.keepMovingForward)
|
|
{
|
|
boatSimulator.keepMovingForward = false;
|
|
boatSimulator.StopBoat();
|
|
transform.parent = boatSimulator.enterPosition;
|
|
}
|
|
if (boatSimulator.watchFishOnSide && Mathf.Sign(boatSimulator.watchFishPosition.localPosition.x) != Mathf.Sign(transform.localPosition.x))
|
|
{
|
|
boatSimulator.watchFishPosition.localPosition = new Vector3(0f - boatSimulator.watchFishPosition.localPosition.x, boatSimulator.watchFishPosition.localPosition.y, boatSimulator.watchFishPosition.localPosition.z);
|
|
boatSimulator.watchFishPosition.localEulerAngles += Vector3.up * 180f;
|
|
boatSimulator.watchPlayerPosition.localPosition = new Vector3(0f - boatSimulator.watchPlayerPosition.localPosition.x, boatSimulator.watchPlayerPosition.localPosition.y, boatSimulator.watchPlayerPosition.localPosition.z);
|
|
boatSimulator.watchPlayerPosition.localEulerAngles += Vector3.up * 180f;
|
|
Debug.LogError("watchFishOnSide change");
|
|
}
|
|
if (fish.animController.fishAnimSwim.useXAxisForSwim)
|
|
{
|
|
showObject.transform.localEulerAngles = boatSimulator.watchFishPosition.eulerAngles + new Vector3(0f, 0f, -100f);
|
|
}
|
|
else
|
|
{
|
|
showObject.transform.eulerAngles = boatSimulator.watchFishPosition.eulerAngles;
|
|
}
|
|
Vector3 newPos = boatSimulator.watchFishPosition.position;
|
|
newPos += fish.transform.forward * (fish.Length * 0.3f);
|
|
newPos.y = -0.2f;
|
|
showObject.transform.position = newPos;
|
|
characteController.enabled = false;
|
|
ufpsController.enabled = false;
|
|
ufpsCamera.enabled = false;
|
|
SetPosition(boatSimulator.watchPlayerPosition.position);
|
|
SetRotation(boatSimulator.watchPlayerPosition.eulerAngles);
|
|
ufpsCamera.transform.eulerAngles = new Vector3(45f, ufpsCamera.transform.eulerAngles.y, ufpsCamera.transform.eulerAngles.z);
|
|
Zoom(true, 0.01f, Mathf.Lerp(0.7f, 1f, Mathf.InverseLerp(1.5f, 5.5f, fish.Length)));
|
|
currentHands.HideHandsCamera(true, false);
|
|
if (VRManager.IsVROn())
|
|
{
|
|
currentHands.HideRod();
|
|
}
|
|
gameController.weatherLevelManager.UpdateWaterProfiles();
|
|
yield return new WaitForSeconds(0.3f);
|
|
gameController.hudManager.FadeDark(0f, 0.3f);
|
|
}
|
|
}
|
|
else if (currentWatchStyle == Fish.WatchStyle.HANDS)
|
|
{
|
|
fish.animController.ChangeAnimation(FishAnimationController.AnimType.WATCH);
|
|
if (fish.animController.fishWatchAnims.Count > 0)
|
|
{
|
|
fish.animController.fishWatchAnims[0].enabled = false;
|
|
}
|
|
yield return new WaitForSeconds(1f);
|
|
if ((bool)fish)
|
|
{
|
|
fish.particleSwim.Stop();
|
|
}
|
|
if (fish.Length > 1.5f)
|
|
{
|
|
showObject.transform.parent = currentHands.watchBigHandsPosition.transform;
|
|
currentHands.ShowArmRenderers(false);
|
|
}
|
|
else
|
|
{
|
|
showObject.transform.parent = currentHands.watchHandsPosition.transform;
|
|
}
|
|
SetShowObjectPosition();
|
|
if (VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
yield return new WaitForSeconds(0.3f);
|
|
vrWatchHandsCameraStartAngle = ufpsCamera.transform.localEulerAngles.y;
|
|
gameController.hudManager.FadeDark(0f, 0.3f);
|
|
}
|
|
}
|
|
else if (currentWatchStyle == Fish.WatchStyle.HOOK_LIGHT && (bool)fish)
|
|
{
|
|
Transform parent = fish.mouth.parent;
|
|
fish.mouth.parent = fish.transform;
|
|
Vector3 vector = currentHands.watchFishPosition.localPosition - new Vector3(0f, 0f, 0f);
|
|
vector.y -= fish.mouth.localPosition.z * fish.transform.localScale.z;
|
|
if (gameController.iceLevel)
|
|
{
|
|
showObject.transform.localEulerAngles = currentHands.watchFishPosition.localEulerAngles;
|
|
showObject.transform.position = drillingController.currentHole.centerDown;
|
|
LeanTween.moveLocal(showObject, vector, 0.75f).setOnComplete((Action)delegate
|
|
{
|
|
fish.isWatchingFishReady = true;
|
|
});
|
|
}
|
|
else
|
|
{
|
|
float num = Vector3.Distance(showObject.transform.localPosition, vector) / currentHands.watchFishFlySpeed;
|
|
LeanTween.rotateLocal(showObject, currentHands.watchFishPosition.localEulerAngles, num * 0.6f);
|
|
if (VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
num *= 0.4f;
|
|
vector = currentHands.fishingRod.GetVRBaitHoldPosition(true);
|
|
LeanTween.move(showObject, vector, num).setOnComplete((Action)delegate
|
|
{
|
|
fish.isWatchingFishReady = true;
|
|
});
|
|
}
|
|
else
|
|
{
|
|
LeanTween.moveLocal(showObject, vector, num).setOnComplete((Action)delegate
|
|
{
|
|
fish.isWatchingFishReady = true;
|
|
});
|
|
}
|
|
}
|
|
fish.mouth.parent = parent;
|
|
}
|
|
else if (currentWatchStyle == Fish.WatchStyle.HOOK_LIGHT && (bool)junk)
|
|
{
|
|
currentHands.watchFishLine.gameObject.SetActive(true);
|
|
float num2 = Vector3.Distance(showObject.transform.localPosition, currentHands.watchJunkPosition.localPosition) / currentHands.watchFishJunkSpeed;
|
|
Debug.Log("Show Object flyTime: " + num2);
|
|
LeanTween.rotateLocal(showObject, junk.watchRotation, num2 * 0.6f);
|
|
LeanTween.moveLocal(showObject, currentHands.watchJunkPosition.localPosition - new Vector3(0f, 0f, 0f), num2);
|
|
}
|
|
if ((bool)fish)
|
|
{
|
|
fish.ChangeMaterial(true);
|
|
if (fish.watchStyle != Fish.WatchStyle.BOAT)
|
|
{
|
|
LeanTween.delayedCall((!gameController.iceLevel) ? 0f : 0.5f, (Action)delegate
|
|
{
|
|
Utilities.SetLayerRecursively(showObject.gameObject, "Weapon");
|
|
});
|
|
}
|
|
}
|
|
else if ((bool)junk)
|
|
{
|
|
Utilities.SetLayerRecursively(showObject.gameObject, "Default");
|
|
}
|
|
if ((bool)fish)
|
|
{
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.WATCH_FISH_01, (!VRManager.IsVROn()) ? 1f : 0.2f);
|
|
fish.particleSwim.Stop();
|
|
}
|
|
LeanTween.delayedCall(0.1f, (Action)delegate
|
|
{
|
|
currentHands.fishingRod.ResetBend();
|
|
});
|
|
LeanTween.delayedCall(2f, (Action)delegate
|
|
{
|
|
if (Vector3.Distance(currentHands.leftArmReelParent.transform.localPosition, currentHands.leftArmReelParentStartPos) > 0.05f)
|
|
{
|
|
currentHands.leftArmReelParent.transform.localPosition = currentHands.leftArmReelParentStartPos;
|
|
}
|
|
});
|
|
}
|
|
|
|
private void SetShowObjectPosition()
|
|
{
|
|
GameObject gameObject = ((!fish) ? junk.gameObject : fish.gameObject);
|
|
if (fish == null)
|
|
{
|
|
Debug.LogError("SetShowObjectPosition fish == null");
|
|
}
|
|
else if (currentWatchStyle == Fish.WatchStyle.HOOK_LIGHT)
|
|
{
|
|
if (fish.isWatchingFishReady && !VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
Transform parent = fish.mouth.parent;
|
|
fish.mouth.parent = fish.transform;
|
|
gameObject.transform.localPosition = currentHands.watchFishPosition.localPosition - new Vector3(0f, fish.mouth.localPosition.z * fish.transform.localScale.z, 0f);
|
|
fish.mouth.parent = parent;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (fish.watchStyle != Fish.WatchStyle.HANDS)
|
|
{
|
|
return;
|
|
}
|
|
if (VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
fish.transform.parent = transform;
|
|
if (fish.animController.fishAnimSwim.useXAxisForSwim)
|
|
{
|
|
fish.transform.localEulerAngles = new Vector3(0f, -90f, 10f);
|
|
}
|
|
else
|
|
{
|
|
fish.transform.localEulerAngles = new Vector3(0f, -90f, -60f);
|
|
}
|
|
fish.transform.localEulerAngles += new Vector3(0f, vrWatchHandsCameraStartAngle, 0f);
|
|
fish.transform.position = VRControllersManager.Instance.GetVRController(OVRInput.Controller.RTouch).transform.position;
|
|
fish.transform.position += fish.transform.forward * (fish.Length * 0.5f + 0.3f);
|
|
fish.transform.localPosition += new Vector3(0f, -0.1f, 0.1f);
|
|
}
|
|
else
|
|
{
|
|
if (fish.animController.fishAnimSwim.useXAxisForSwim)
|
|
{
|
|
gameObject.transform.localEulerAngles = new Vector3(0f, 0f, 70f);
|
|
}
|
|
else
|
|
{
|
|
gameObject.transform.localEulerAngles = Vector3.zero;
|
|
}
|
|
if (fish.Length > 1.5f)
|
|
{
|
|
gameObject.transform.localPosition = Vector3.zero + new Vector3(0f, fish.boxCollider.size.y * fish.transform.localScale.x * 0.25f, fish.Length * 0.4f);
|
|
}
|
|
else
|
|
{
|
|
gameObject.transform.localPosition = Vector3.zero + new Vector3((0f - fish.boxCollider.size.x) * fish.transform.localScale.x * 0.3f, 0f, fish.Length * 0.4f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
[Button]
|
|
public void RestWatchFish()
|
|
{
|
|
currentHands.bait.transform.position = currentHands.watchFishPosition.position;
|
|
if ((bool)currentHands.fishingFloat)
|
|
{
|
|
currentHands.bait.transform.position += Vector3.up * 0.7f;
|
|
}
|
|
Debug.LogError("currentHands.bait.transform.position " + currentHands.bait.transform.position);
|
|
Debug.LogError("currentHands.watchFishPosition.position " + currentHands.watchFishPosition.position);
|
|
currentHands.currentRope.regenerateRope(false);
|
|
}
|
|
|
|
public bool IsSomethingOnBait()
|
|
{
|
|
return HasFishOnCurrentRod();
|
|
}
|
|
|
|
public void WatchFishDecision(int decision)
|
|
{
|
|
Debug.Log("WatchFishDecision " + decision);
|
|
if ((bool)fish && (bool)GlobalSettings.Instance && !gameController.fisheryEditorGame)
|
|
{
|
|
GlobalSettings.Instance.fishManager.AddSpeciesLevel(fish);
|
|
}
|
|
if ((bool)fish)
|
|
{
|
|
fish.ChangeMaterial(false);
|
|
}
|
|
if ((bool)fish && fish.watchStyle == Fish.WatchStyle.BOAT)
|
|
{
|
|
currentHands.HideHandsCamera(false);
|
|
Zoom(false, 0f);
|
|
if ((bool)boatSimulator)
|
|
{
|
|
boatSimulator.PauseFloating(false);
|
|
}
|
|
}
|
|
switch (decision)
|
|
{
|
|
case 1:
|
|
fish.ReleaseFish(true, Vector3.zero, Vector3.zero);
|
|
fish = null;
|
|
break;
|
|
case 5:
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
GlobalSettings.Instance.fishManager.KeepFish(fish, GlobalSettings.Instance.levelsManager.GetCurrentFishery().name);
|
|
}
|
|
fish.ReleaseFish(true, Vector3.zero, Vector3.zero);
|
|
fish = null;
|
|
break;
|
|
case 2:
|
|
{
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
}
|
|
Vector3 vector = fish.pullOutPosition - transform.position;
|
|
if (gameController.iceLevel)
|
|
{
|
|
fish.ReleaseFish(true, Vector3.zero, Vector3.zero);
|
|
}
|
|
else
|
|
{
|
|
fish.ReleaseFish(false, fish.pullOutPosition + new Vector3(0f, 1f, 0f), new Vector3(60f, transform.eulerAngles.y, 0f));
|
|
}
|
|
fish = null;
|
|
break;
|
|
}
|
|
}
|
|
if ((bool)junk && !junk.isExploding)
|
|
{
|
|
ResetJunk();
|
|
}
|
|
currentHands.animator.SetBool("WatchFish", false);
|
|
currentHands.watchFishLine.gameObject.SetActive(false);
|
|
if (VRManager.IsVROn())
|
|
{
|
|
currentHands.ShowRightArm();
|
|
}
|
|
currentHands.ActivateRopes(true);
|
|
currentHands.ShowRod();
|
|
LeanForward();
|
|
characteController.enabled = true;
|
|
ufpsController.enabled = true;
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
ufpsCamera.enabled = true;
|
|
}
|
|
if (gameController.iceLevel)
|
|
{
|
|
currentHands.ShowRightArm();
|
|
currentHands.ShowLeftArm();
|
|
ChangeState(PlayerState.ICE_FISHING);
|
|
}
|
|
else
|
|
{
|
|
ChangeState(PlayerState.NORMAL);
|
|
TurnOnSpring(true);
|
|
LeanTween.value(0f, 1f, 1f).setOnComplete((Action)delegate
|
|
{
|
|
if ((bool)currentHands)
|
|
{
|
|
currentHands.HideLeftArm();
|
|
}
|
|
else
|
|
{
|
|
Debug.LogError("WatchFishDecision LeanTween currentHands == null");
|
|
}
|
|
});
|
|
}
|
|
currentHands.ShowRopes(true);
|
|
currentHands.ShowArmRenderers(true);
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.HOOKS_01, 1f);
|
|
if (gameController.isMultiplayer && (bool)MultiplayerManager.Instance)
|
|
{
|
|
MultiplayerManager.Instance.UpdateMyStats();
|
|
}
|
|
if (gameController.fisheryEditorGame == null)
|
|
{
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
GlobalSettings.Instance.playerSettings.Save();
|
|
}
|
|
if ((bool)LeaderboardsManager.Instance)
|
|
{
|
|
LeaderboardsManager.Instance.UploadAllScores(".MAIN.");
|
|
LeaderboardsManager.Instance.UploadAllScores(GlobalSettings.Instance.levelsManager.GetCurrentFishery().leaderboardName);
|
|
}
|
|
if ((bool)SteamStatsManager.Instance)
|
|
{
|
|
SteamStatsManager.Instance.StoreStats();
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ToggleFlashlight()
|
|
{
|
|
AudioController.Play((!currentHands.flashLight.enabled) ? "Flashlight_ON_01" : "Flashlight_OFF_01");
|
|
LeanTween.delayedCall(0.1f, (Action)delegate
|
|
{
|
|
currentHands.flashLight.enabled = !currentHands.flashLight.enabled;
|
|
});
|
|
}
|
|
|
|
public void TurnOnHunterVision()
|
|
{
|
|
if (!isHunterVisionOn && currentState != PlayerState.WATCH_FISH && currentState != PlayerState.DEATH && !underwaterCamera.isTurnedOn && (!GlobalSettings.Instance || (bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.HUNTER_VISION_1).isUnlocked || (bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.HUNTER_VISION_2).isUnlocked || (bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.HUNTER_VISION_3).isUnlocked) && (!GlobalSettings.Instance || GlobalSettings.Instance.playerSettings.IsCasual()))
|
|
{
|
|
StartCoroutine(HunterVision());
|
|
}
|
|
}
|
|
|
|
public IEnumerator EatIceFishing()
|
|
{
|
|
ChangeState(PlayerState.NORMAL);
|
|
yield return new WaitForSeconds(2f);
|
|
currentHands.Eat();
|
|
yield return new WaitForSeconds(6f);
|
|
currentHands.ShowLeftArm();
|
|
ChangeState(PlayerState.ICE_FISHING);
|
|
}
|
|
|
|
public void SetTournamentPlayer(TournamentPlayer tournamentPl)
|
|
{
|
|
tournamentPlayer = tournamentPl;
|
|
tournamentPlayer.isAi = false;
|
|
tournamentPlayer.isLocalPlayer = true;
|
|
UpdateTournamentPlayerName();
|
|
}
|
|
|
|
public void UpdateTournamentPlayerName()
|
|
{
|
|
if (!(tournamentPlayer == null))
|
|
{
|
|
if ((bool)MultiplayerManager.Instance && PhotonNetwork.connected)
|
|
{
|
|
tournamentPlayer.playerName = PhotonNetwork.playerName;
|
|
}
|
|
else if ((bool)GlobalSettings.Instance)
|
|
{
|
|
tournamentPlayer.playerName = GlobalSettings.Instance.playerSettings.playersName;
|
|
}
|
|
else
|
|
{
|
|
tournamentPlayer.playerName = "Editor Player";
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ExitBoatCoroutine()
|
|
{
|
|
StartCoroutine(EnterBoat(false, boatSimulator));
|
|
}
|
|
|
|
public IEnumerator EnterBoat(bool enter, BoatSimulator boat)
|
|
{
|
|
if (!(gameController.hudManager.fadeDark.color.a > 0f))
|
|
{
|
|
allowFishing = false;
|
|
gameController.resetingPlayer = true;
|
|
gameController.hudManager.FadeDark(1f, 0.4f);
|
|
yield return new WaitForSeconds(0.4f);
|
|
EnterBoatInstant(enter, boat);
|
|
yield return new WaitForSeconds((!gameController.newSpawnersDeactivateMethod || enter) ? 0.2f : 2f);
|
|
gameController.hudManager.FadeDark(0f, (!gameController.newSpawnersDeactivateMethod || enter) ? 0.4f : 2f);
|
|
allowFishing = true;
|
|
gameController.hudManager.UpdateControls();
|
|
if (enter)
|
|
{
|
|
boat.PlayEngineStartSound(true);
|
|
}
|
|
gameController.resetingPlayer = false;
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.BOAT_01, 0.9f);
|
|
}
|
|
}
|
|
|
|
public void EnterBoatInstant(bool enter, BoatSimulator boat)
|
|
{
|
|
SphereCollider component = GetComponent<SphereCollider>();
|
|
if ((bool)component)
|
|
{
|
|
if (enter)
|
|
{
|
|
component.center = Vector3.up * 1.45f;
|
|
}
|
|
else
|
|
{
|
|
component.center = Vector3.up * 0.85f;
|
|
}
|
|
}
|
|
if (!enter)
|
|
{
|
|
DriveBoatInstant(false);
|
|
characteController.enabled = false;
|
|
}
|
|
if ((bool)FishingHands.rodStand)
|
|
{
|
|
FishingHands.rodStand.TakeStand();
|
|
}
|
|
FishingHands.rodStand = ((!enter) ? FishingHands.rodStandFromEquipment : boat.rodStand);
|
|
boat.EnterBoat(enter);
|
|
ChangeState(PlayerState.NORMAL);
|
|
dustParticles.gameObject.SetActive(!enter && !gameController.iceLevel);
|
|
waterInteractive.enabled = !enter;
|
|
if (boat.changePlayerParent)
|
|
{
|
|
transform.parent = ((!enter) ? null : boat.enterPosition);
|
|
transform.localPosition = Vector3.zero;
|
|
transform.localEulerAngles = Vector3.zero;
|
|
}
|
|
SetPosition((!enter) ? boat.exitPosition.position : boat.enterPosition.position);
|
|
if (!playerWasInBoat)
|
|
{
|
|
SetRotation((!enter) ? boat.exitPosition.eulerAngles : boat.enterPosition.eulerAngles);
|
|
}
|
|
if (!enter)
|
|
{
|
|
boat.PlayEngineStartSound(false);
|
|
StartCoroutine(ExitBoat());
|
|
}
|
|
if (enter)
|
|
{
|
|
boatSimulator = boat;
|
|
DriveBoatInstant(true);
|
|
if (boatSimulator.isKayak)
|
|
{
|
|
ufpsController.AllowMoveInput = false;
|
|
SitDown(boatSimulator.kayakSitHeight, false);
|
|
ufpsCamera.transform.localPosition = new Vector3(ufpsCamera.transform.localPosition.x, boatSimulator.kayakSitHeight, ufpsCamera.transform.localPosition.z);
|
|
}
|
|
}
|
|
}
|
|
|
|
public IEnumerator ExitBoat()
|
|
{
|
|
if ((bool)boatSimulator)
|
|
{
|
|
yield return null;
|
|
gameController.fisheryExitCounter = 0;
|
|
characteController.enabled = true;
|
|
characteController.SimpleMove(Vector3.zero);
|
|
ufpsController.Stop();
|
|
boatSimulator.StopBoat();
|
|
boatSimulator = null;
|
|
ufpsController.AllowMoveInput = true;
|
|
SitDown(-1f, false);
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
}
|
|
|
|
public IEnumerator DriveBoat(bool start)
|
|
{
|
|
if ((bool)boatSimulator && !(gameController.hudManager.fadeDark.color.a > 0f))
|
|
{
|
|
if (start && boatSimulator.engineIdleAudioObject != null && !boatSimulator.engineIdleAudioObject.isFadeOutComplete)
|
|
{
|
|
yield return null;
|
|
}
|
|
gameController.hudManager.FadeDark(1f, 0.2f);
|
|
if (start)
|
|
{
|
|
yield return new WaitForSeconds(1f);
|
|
}
|
|
else
|
|
{
|
|
yield return new WaitForSeconds(0.2f);
|
|
}
|
|
DriveBoatInstant(start);
|
|
yield return new WaitForSeconds(0.1f);
|
|
gameController.hudManager.FadeDark(0f, 0.2f);
|
|
boatSimulator.ResetRotations();
|
|
}
|
|
}
|
|
|
|
public void DriveBoatInstant(bool start)
|
|
{
|
|
if (!boatSimulator)
|
|
{
|
|
return;
|
|
}
|
|
if (start)
|
|
{
|
|
boatSimulator.ChangeState(BoatSimulator.BoatState.PLAYER_DRIVING);
|
|
ChangeState(PlayerState.DRIVING_BOAT);
|
|
if (isHandsCameraVisible)
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
ufpsCameraCamera.cullingMask ^= 1 << LayerMask.NameToLayer("Weapon");
|
|
}
|
|
else
|
|
{
|
|
ufpsWeaponCamera.cullingMask ^= 1 << LayerMask.NameToLayer("Weapon");
|
|
}
|
|
}
|
|
if (boatSimulator.isKayak)
|
|
{
|
|
Utilities.SetLayerRecursively(currentHands.kayakHandsParent, LayerMask.NameToLayer("Default"));
|
|
currentHands.kayakHandsParent.SetActive(true);
|
|
if ((bool)boatSimulator.paddles)
|
|
{
|
|
boatSimulator.paddles.transform.parent.gameObject.SetActive(false);
|
|
}
|
|
currentHands.kayakHandsAnimation.parent = transform;
|
|
SitDown(boatSimulator.kayakSitHeight, false);
|
|
ufpsCamera.transform.localPosition = new Vector3(ufpsCamera.transform.localPosition.x, boatSimulator.kayakSitHeight, ufpsCamera.transform.localPosition.z);
|
|
}
|
|
ufpsCamera.enabled = false;
|
|
transform.parent = boatSimulator.enterPosition;
|
|
SetPosition(boatSimulator.enterPosition.position);
|
|
if (!playerWasInBoat || VRManager.IsVROn())
|
|
{
|
|
SetRotation(boatSimulator.enterPosition.eulerAngles);
|
|
}
|
|
ufpsCamera.transform.eulerAngles = new Vector3(0f, ufpsCamera.transform.eulerAngles.y, ufpsCamera.transform.eulerAngles.z);
|
|
ufpsCamera.transform.localPosition = new Vector3(ufpsCamera.transform.localPosition.x, playerHeight, ufpsCamera.transform.localPosition.z);
|
|
gameController.hudManager.ShowRadar(!boatSimulator.isKayak);
|
|
gameController.weatherLevelManager.UpdateWaterProfiles();
|
|
}
|
|
else
|
|
{
|
|
StartCoroutine(StopDriving());
|
|
transform.parent = ((!boatSimulator.keepMovingForward) ? boatSimulator.enterPosition : null);
|
|
}
|
|
characteController.enabled = !start;
|
|
}
|
|
|
|
public IEnumerator StopDriving()
|
|
{
|
|
if (!boatSimulator)
|
|
{
|
|
yield break;
|
|
}
|
|
boatSimulator.ChangeState(BoatSimulator.BoatState.PLAYER_FISHING);
|
|
ChangeState(PlayerState.NORMAL);
|
|
if (isHandsCameraVisible)
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
ufpsCameraCamera.cullingMask |= 1 << LayerMask.NameToLayer("Weapon");
|
|
}
|
|
else
|
|
{
|
|
ufpsWeaponCamera.cullingMask |= 1 << LayerMask.NameToLayer("Weapon");
|
|
}
|
|
}
|
|
if (boatSimulator.isKayak)
|
|
{
|
|
currentHands.kayakHandsAnimation.parent = currentHands.kayakHandsParent.transform;
|
|
currentHands.kayakHandsParent.SetActive(false);
|
|
if ((bool)boatSimulator.paddles)
|
|
{
|
|
boatSimulator.paddles.transform.parent.gameObject.SetActive(true);
|
|
}
|
|
}
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
ufpsCamera.enabled = true;
|
|
}
|
|
if ((bool)boatSimulator.fishingPosition)
|
|
{
|
|
SetPosition(boatSimulator.fishingPosition.position);
|
|
SetRotation(boatSimulator.fishingPosition.eulerAngles);
|
|
}
|
|
gameController.hudManager.ShowRadar(false);
|
|
yield return null;
|
|
gameController.weatherLevelManager.UpdateWaterProfiles();
|
|
}
|
|
|
|
public void SetPosition(Vector3 newPosition)
|
|
{
|
|
ufpsController.SetPosition(newPosition);
|
|
ufpsController.Stop();
|
|
if ((bool)currentHands && !currentHands.baitWasThrown)
|
|
{
|
|
if ((bool)currentHands.fishingFloat)
|
|
{
|
|
currentHands.fishingFloat.ResetFloat();
|
|
}
|
|
currentHands.bait.ResetBait();
|
|
}
|
|
}
|
|
|
|
public IEnumerator SetPositionFade(Vector3 newPosition, float fadeDuration)
|
|
{
|
|
if (!HUDManager.Instance)
|
|
{
|
|
SetPosition(newPosition);
|
|
yield break;
|
|
}
|
|
HUDManager.Instance.FadeDark(1f, fadeDuration);
|
|
yield return new WaitForSeconds(fadeDuration);
|
|
SetPosition(newPosition);
|
|
yield return new WaitForSeconds(0.05f);
|
|
HUDManager.Instance.FadeDark(0f, fadeDuration);
|
|
}
|
|
|
|
public void SetRotation(Vector3 eulerAngles)
|
|
{
|
|
if (ufpsCamera.enabled)
|
|
{
|
|
ufpsCamera.SetRotation(eulerAngles);
|
|
}
|
|
else
|
|
{
|
|
transform.eulerAngles = eulerAngles;
|
|
}
|
|
}
|
|
|
|
public IEnumerator SetRotationFade(Vector3 eulerAngles, float fadeDuration)
|
|
{
|
|
if (!HUDManager.Instance)
|
|
{
|
|
SetRotation(eulerAngles);
|
|
yield break;
|
|
}
|
|
HUDManager.Instance.FadeDark(1f, fadeDuration);
|
|
yield return new WaitForSeconds(fadeDuration);
|
|
SetRotation(eulerAngles);
|
|
yield return new WaitForSeconds(0.05f);
|
|
HUDManager.Instance.FadeDark(0f, fadeDuration);
|
|
}
|
|
|
|
public void SetPositionAndRotation(Vector3 newPosition, Vector3 eulerAngles)
|
|
{
|
|
SetPosition(newPosition);
|
|
SetRotation(eulerAngles);
|
|
}
|
|
|
|
public IEnumerator SetPositionAndRotationFade(Vector3 newPosition, Vector3 eulerAngles, float fadeDuration)
|
|
{
|
|
if (!HUDManager.Instance)
|
|
{
|
|
SetPosition(newPosition);
|
|
yield break;
|
|
}
|
|
HUDManager.Instance.FadeDark(1f, fadeDuration);
|
|
yield return new WaitForSeconds(fadeDuration);
|
|
SetPosition(newPosition);
|
|
SetRotation(eulerAngles);
|
|
yield return new WaitForSeconds(0.05f);
|
|
HUDManager.Instance.FadeDark(0f, fadeDuration);
|
|
}
|
|
|
|
public void CameraLookAt(Vector3 goal, Vector3 offset, float tweenTime)
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
return;
|
|
}
|
|
ufpsCamera.SetRotation(ufpsCamera.Transform.eulerAngles, false);
|
|
Quaternion quaternion = Quaternion.LookRotation(goal + offset - ufpsCamera.transform.position);
|
|
Vector2 vector = new Vector2(quaternion.eulerAngles.x, quaternion.eulerAngles.y);
|
|
if (vector.x > 180f)
|
|
{
|
|
vector.x -= 360f;
|
|
}
|
|
if (tweenTime == 0f)
|
|
{
|
|
ufpsCamera.Angle = vector;
|
|
return;
|
|
}
|
|
LeanTween.value(base.gameObject, delegate(Vector2 v)
|
|
{
|
|
ufpsCamera.Angle = v;
|
|
}, ufpsCamera.Angle, vector, tweenTime).setEase(LeanTweenType.easeInOutQuad);
|
|
}
|
|
|
|
public void CameraLookAt(Transform goal, Vector3 offset, float tweenTime)
|
|
{
|
|
CameraLookAt(goal.position, offset, tweenTime);
|
|
}
|
|
|
|
public void SetHorizontalRotationLimit(float left, float right)
|
|
{
|
|
}
|
|
|
|
public void BlockMouseLook(bool block, float normalSensitivity = 4f)
|
|
{
|
|
ufpsInput.MouseLookSensitivity = new Vector2((!block) ? normalSensitivity : 0f, (!block) ? normalSensitivity : 0f);
|
|
CurrentMouseLookSensitivity = ufpsInput.MouseLookSensitivity;
|
|
RefreshInputSettings();
|
|
}
|
|
|
|
public void BlockVerticalMouseLook(bool block, float normalSensitivity = 4f)
|
|
{
|
|
ufpsInput.MouseLookSensitivity = new Vector2(normalSensitivity, (!block) ? normalSensitivity : 0f);
|
|
CurrentMouseLookSensitivity = ufpsInput.MouseLookSensitivity;
|
|
RefreshInputSettings();
|
|
}
|
|
|
|
public void RefreshInputSettings()
|
|
{
|
|
ufpsInput.MouseLookSensitivity = CurrentMouseLookSensitivity;
|
|
if (underwaterCamera.isTurnedOn)
|
|
{
|
|
ufpsInput.MouseLookSensitivity *= 0.4f;
|
|
}
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
ufpsInput.MouseLookSensitivity *= GlobalSettings.Instance.playerSettings.mouseSensitivity;
|
|
ufpsInput.MouseLookInvert = GlobalSettings.Instance.playerSettings.invertYAxis < 0f;
|
|
}
|
|
}
|
|
|
|
public void AllowInteraction(bool allow)
|
|
{
|
|
ufpsInteractiveManage.MaxInteractDistance = ((!allow) ? (-1f) : 25f);
|
|
}
|
|
|
|
public void Zoom(bool zoom, float duration, float zoomValue = 0.75f)
|
|
{
|
|
if ((!zoom || !(ufpsWeaponCamera.fieldOfView < CurrentFieldOfView * ZoomFieldOfView)) && (zoom || ufpsWeaponCamera.fieldOfView != CurrentFieldOfView))
|
|
{
|
|
LeanTween.value(base.gameObject, UpdateZoom, (!zoom) ? zoomValue : 1f, (!zoom) ? 1f : zoomValue, duration);
|
|
}
|
|
}
|
|
|
|
public void UpdateZoom(float zoomValue)
|
|
{
|
|
ZoomFieldOfView = zoomValue;
|
|
}
|
|
|
|
[Button]
|
|
public void LeanForwardTest()
|
|
{
|
|
LeanForward(UnityEngine.Random.Range(0.1f, 1.5f));
|
|
}
|
|
|
|
public void LeanForward(float distance = 0.1f)
|
|
{
|
|
if (!VRManager.IsVROn() && ufpsCamera.PositionOffset.z != distance)
|
|
{
|
|
Debug.Log("LeanForward: " + distance);
|
|
ufpsCamera.PositionOffset.z = distance;
|
|
ufpsCamera.Refresh();
|
|
}
|
|
}
|
|
|
|
public bool CanChangeEquipment()
|
|
{
|
|
if (underwaterCamera.isTurnedOn || underwaterCamera.isChanging)
|
|
{
|
|
return false;
|
|
}
|
|
if (gameController.iceLevel)
|
|
{
|
|
return currentState == PlayerState.NORMAL || (currentState == PlayerState.ICE_FISHING && !fish);
|
|
}
|
|
return currentState == PlayerState.NORMAL || (currentState == PlayerState.FISHING && !currentHands.baitWasThrown && !currentHands.isThrowingNear && !currentHands.isThrowing);
|
|
}
|
|
|
|
public void ShowRod(bool show)
|
|
{
|
|
if (show)
|
|
{
|
|
LeanTween.rotateLocal(currentHands.rightArm, new Vector3(0f, 0f, 0f), 1f);
|
|
AudioController.Play("ArmShow_01", transform);
|
|
}
|
|
else
|
|
{
|
|
LeanTween.rotateLocal(currentHands.rightArm, new Vector3(0f, -90f, 40f), 1f);
|
|
AudioController.Play("ArmHide_01", transform);
|
|
}
|
|
}
|
|
|
|
public void SitDown(float sitDownHeight, bool drilling = true)
|
|
{
|
|
Debug.Log("SitDown: " + ((!(sitDownHeight > 0f)) ? playerHeight : sitDownHeight));
|
|
if (sitDownHeight > 0f && drilling)
|
|
{
|
|
float num = defaultHoleDistance + currentHands.fishingRod.rodLength;
|
|
float num2 = Vector3.Distance(transform.position, drillingController.currentHole.holeCenter.position);
|
|
Vector3 to = drillingController.currentHole.holeCenter.position + (transform.position - drillingController.currentHole.holeCenter.position).normalized * num;
|
|
to.y = transform.position.y;
|
|
Debug.Log("Ice Sit currentDistance: " + num2 + " newDistance: " + num + " difference: " + (num2 - num));
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
LeanTween.move(base.gameObject, to, 0.3f).setOnComplete((Action)delegate
|
|
{
|
|
LeanTween.delayedCall(0.3f, (Action)delegate
|
|
{
|
|
});
|
|
CameraLookAt(drillingController.currentHole.transform, new Vector3(0f, fishingController.iceFishingLookHeight, 0f), 0.3f);
|
|
});
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ufpsCamera.PositionOffset = new Vector3(ufpsCamera.PositionOffset.x, (!(sitDownHeight > 0f)) ? playerHeight : sitDownHeight, ufpsCamera.PositionOffset.z);
|
|
ufpsCamera.Refresh();
|
|
}
|
|
if (VRManager.IsVROn())
|
|
{
|
|
ChangeVRCameraHeight(VRManager.Instance.cameraHeight);
|
|
}
|
|
isDuringAnimation = true;
|
|
LeanTween.delayedCall(1.5f, (Action)delegate
|
|
{
|
|
isDuringAnimation = false;
|
|
if (sitDownHeight < 0f && drilling && gameController.iceLevel)
|
|
{
|
|
currentHands.ShowWalkingDriller(true);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void ShowHands(bool show)
|
|
{
|
|
if ((bool)currentHands)
|
|
{
|
|
currentHands.gameObject.SetActive(show);
|
|
}
|
|
}
|
|
|
|
public void TurnOnSpring(bool turnOn, float value = -1f)
|
|
{
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
ufpsWeapon.RotationLookSway = ((!turnOn) ? Vector3.zero : new Vector3(1f, 1f, -2.5f));
|
|
ufpsWeapon.Refresh();
|
|
}
|
|
}
|
|
|
|
public void EnterChat(bool enter)
|
|
{
|
|
if (enter)
|
|
{
|
|
ufpsController.Stop();
|
|
}
|
|
}
|
|
|
|
public void WaterSplash(float strength, float delay = 0f)
|
|
{
|
|
if ((!GlobalSettings.Instance || GlobalSettings.Instance.renderSettings.GetQualityDefinition().useCameraWaterDrops) && (bool)waterDropsRainMy)
|
|
{
|
|
waterDropsRainMy.SpawnRandom((int)Mathf.Lerp(10f, 30f, strength));
|
|
AudioController.Play("SplashCamera_01");
|
|
}
|
|
}
|
|
|
|
public float GetFishDistanceAnimation()
|
|
{
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
return fishDistanceAnimation * GlobalSettings.Instance.renderSettings.GetQualityDefinition().fishDistanceAnimationMultiplier;
|
|
}
|
|
return fishDistanceAnimation;
|
|
}
|
|
|
|
public void CalculateFishDistanceBehavior()
|
|
{
|
|
if ((bool)fish)
|
|
{
|
|
currentFishDistanceBehavior = 30f;
|
|
}
|
|
else if (underwaterCamera.isTurnedOn)
|
|
{
|
|
currentFishDistanceBehavior = 30f;
|
|
}
|
|
else if (currentHands.bait.isOnWater)
|
|
{
|
|
currentFishDistanceBehavior = 30f;
|
|
}
|
|
else if (currentHands.baitWasThrown)
|
|
{
|
|
currentFishDistanceBehavior = 60f;
|
|
}
|
|
else if ((bool)GlobalSettings.Instance)
|
|
{
|
|
currentFishDistanceBehavior = fishDistanceBehavior * GlobalSettings.Instance.renderSettings.GetQualityDefinition().fishDistanceBehaviorMultiplier;
|
|
}
|
|
else
|
|
{
|
|
currentFishDistanceBehavior = fishDistanceBehavior;
|
|
}
|
|
if (fishDistanceBehaviorSphere.gameObject.activeSelf)
|
|
{
|
|
fishDistanceBehaviorSphere.localScale = Vector3.one * currentFishDistanceBehavior * 2f;
|
|
fishDistanceBehaviorSphere.parent = ((!underwaterCamera.isTurnedOn) ? transform : underwaterCamera.transform);
|
|
fishDistanceBehaviorSphere.localPosition = Vector3.zero;
|
|
fishDistanceBehaviorSphere.localRotation = Quaternion.identity;
|
|
}
|
|
}
|
|
|
|
public bool HasFishOnCurrentRod()
|
|
{
|
|
return (bool)fish && fish.storedBait.fishingHands == currentHands;
|
|
}
|
|
|
|
public IEnumerator Die()
|
|
{
|
|
if ((bool)junk)
|
|
{
|
|
gameController.hudManager.deathInfoBtn.text = "Pay -" + junk.cost + " $";
|
|
}
|
|
currentHands.animator.SetBool("WatchFish", false);
|
|
currentHands.watchFishLine.gameObject.SetActive(false);
|
|
ChangeState(PlayerState.DEATH);
|
|
AudioController.Play("Death_01", transform);
|
|
CameraLookAt(transform.position + transform.forward * 1f, new Vector3(0f, 4f, 0f), 0.7f);
|
|
SitDown(0.2f, false);
|
|
fxBlood1.enabled = true;
|
|
gaussianBlur.enabled = true;
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.EMPTY);
|
|
yield return new WaitForSeconds(2.5f);
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.DEATH);
|
|
}
|
|
|
|
public void RecoverAfterDeath()
|
|
{
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
GlobalSettings.Instance.playerSettings.AddMoney(-(int)junk.cost);
|
|
}
|
|
StartCoroutine(gameController.ResetPlayer(true));
|
|
}
|
|
|
|
public IEnumerator PooPissLimit(bool poo)
|
|
{
|
|
gameController.hudManager.FadeDark(1f, 0.5f);
|
|
yield return new WaitForSeconds(1.5f);
|
|
StartCoroutine(gameController.ResetPlayer(false));
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.EMPTY);
|
|
gameController.hudManager.pooPissInfo.text = Utilities.GetTranslation("You didn't piss on time.\nBill from laundry") + ": -" + 50f + " $";
|
|
ufpsInput.AllowGameplayInput = false;
|
|
yield return new WaitForSeconds(1f);
|
|
gameController.hudManager.ChangeGameState(HUDManager.GameState.AFTER_POO_PISS);
|
|
gameController.hudManager.FadeDark(0f, 0.5f);
|
|
}
|
|
|
|
public void UpdateParams()
|
|
{
|
|
currentStrengthLevel = 1f;
|
|
}
|
|
|
|
public float GetCurrentStrength()
|
|
{
|
|
return 1f;
|
|
}
|
|
|
|
public void AddStrength(float value)
|
|
{
|
|
}
|
|
|
|
public void CheckStrength()
|
|
{
|
|
}
|
|
|
|
public void SetDrunkLevel(float level, bool instant)
|
|
{
|
|
if ((bool)fxDrunk)
|
|
{
|
|
fxDrunk.enabled = level > 0f;
|
|
}
|
|
if (instant)
|
|
{
|
|
SetDrunkSettings(level, true);
|
|
return;
|
|
}
|
|
LeanTween.delayedCall(base.gameObject, 2f, (Action)delegate
|
|
{
|
|
SetDrunkSettings(level, true);
|
|
});
|
|
LeanTween.value(base.gameObject, drunkLevel, level, 2f).setOnUpdate(delegate(float value)
|
|
{
|
|
SetDrunkSettings(value, false);
|
|
});
|
|
}
|
|
|
|
private void SetDrunkSettings(float value, bool instant)
|
|
{
|
|
float num = value * 0.5f;
|
|
if ((bool)fxDrunk)
|
|
{
|
|
fxDrunk.Wavy = num * 0.8f;
|
|
fxDrunk.DistortionWave = num * 0.02f;
|
|
}
|
|
ufpsCamera.RenderingFieldOfView = 60f + num * num * 40f;
|
|
if (instant)
|
|
{
|
|
ufpsCamera.ShakeSpeed = 0.15f + num * 0.15f;
|
|
ufpsCamera.ShakeAmplitude = new Vector3(10f + num * 70f, 10f + num * 70f, 0f);
|
|
}
|
|
ufpsCamera.BobAmplitude = new Vector4(num, 1f + num, num, 1f + num);
|
|
ufpsController.MotorAcceleration = currentMotorAcceleration - num * 0.15f;
|
|
ufpsCamera.RotationStrafeRoll = 0.01f - num * 2f;
|
|
ufpsCamera.RefreshZoom();
|
|
drunkLevel = value;
|
|
}
|
|
|
|
public IEnumerator HunterVision()
|
|
{
|
|
if (isHunterVisionOn)
|
|
{
|
|
yield break;
|
|
}
|
|
isHunterVisionOn = true;
|
|
float duration = 0f;
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.HUNTER_VISION_1).isUnlocked)
|
|
{
|
|
duration = GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.HUNTER_VISION_1).param_1;
|
|
}
|
|
if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.HUNTER_VISION_2).isUnlocked)
|
|
{
|
|
duration += GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.HUNTER_VISION_2).param_1;
|
|
}
|
|
if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.HUNTER_VISION_3).isUnlocked)
|
|
{
|
|
duration += GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.HUNTER_VISION_3).param_1;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
duration = 3f;
|
|
}
|
|
float tweenTime = 2f;
|
|
grayscale.Amount = 0f;
|
|
grayscale.enabled = true;
|
|
gameController.UpdateHunterFishMaterials(true, tweenTime);
|
|
hunterAudio = AudioController.Play("HunterVision_01", transform);
|
|
if ((bool)hunterAudio)
|
|
{
|
|
hunterAudio.volume = 0f;
|
|
}
|
|
LeanTween.value(0f, 1f, tweenTime).setOnUpdate(delegate(float value)
|
|
{
|
|
grayscale.Amount = value;
|
|
if ((bool)hunterAudio)
|
|
{
|
|
hunterAudio.volume = value * hunterAudio.audioItem.Volume * hunterAudio.subItem.Volume * hunterAudio.category.VolumeTotal;
|
|
}
|
|
});
|
|
gameController.hudManager.UpdateControls();
|
|
yield return new WaitForSeconds(tweenTime);
|
|
yield return new WaitForSeconds(duration);
|
|
LeanTween.value(1f, 0f, tweenTime).setOnUpdate(delegate(float value)
|
|
{
|
|
grayscale.Amount = value;
|
|
if ((bool)hunterAudio)
|
|
{
|
|
hunterAudio.volume = value * hunterAudio.audioItem.Volume * hunterAudio.subItem.Volume * hunterAudio.category.VolumeTotal;
|
|
}
|
|
});
|
|
gameController.UpdateHunterFishMaterials(false, tweenTime);
|
|
yield return new WaitForSeconds(tweenTime);
|
|
grayscale.Amount = 0f;
|
|
grayscale.enabled = false;
|
|
if ((bool)hunterAudio)
|
|
{
|
|
hunterAudio.Stop();
|
|
}
|
|
hunterAudio = null;
|
|
gameController.hudManager.UpdateControls();
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
yield return new WaitForSeconds(12f);
|
|
}
|
|
isHunterVisionOn = false;
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
|
|
public void QuickStopHunterVision()
|
|
{
|
|
gameController.UpdateHunterFishMaterials(false, 0f);
|
|
gameController.ResetHunterFishMaterials();
|
|
grayscale.Amount = 0f;
|
|
grayscale.enabled = false;
|
|
if ((bool)hunterAudio)
|
|
{
|
|
hunterAudio.Stop();
|
|
}
|
|
hunterAudio = null;
|
|
isHunterVisionOn = false;
|
|
gameController.hudManager.UpdateControls();
|
|
}
|
|
|
|
public void UpdateFOV(bool force)
|
|
{
|
|
if (VRManager.IsVROn() || currentHands.transform.parent == null)
|
|
{
|
|
return;
|
|
}
|
|
if (ufpsCameraCamera.fieldOfView != ufpsWeaponCamera.fieldOfView || force)
|
|
{
|
|
}
|
|
if ((bool)postProcessingBehaviour_1 && postProcessingBehaviour_1.profile.antialiasing.settings.method != AntialiasingModel.Method.Taa)
|
|
{
|
|
Debug.LogWarning("Wrong Antialiasing Method");
|
|
}
|
|
if (!gameController.iceLevel)
|
|
{
|
|
Vector3 localPosition = currentHands.transform.parent.localPosition;
|
|
if (currentState == PlayerState.WATCH_FISH)
|
|
{
|
|
localPosition.z = Mathf.Lerp(currentHands.handsFovPositionWatch.x, currentHands.handsFovPositionWatch.y, Mathf.InverseLerp(50f, 100f, CurrentFieldOfView));
|
|
}
|
|
else if (currentHands.baitWasThrown)
|
|
{
|
|
localPosition.z = Mathf.Lerp(currentHands.handsFovPositionFishing.x, currentHands.handsFovPositionFishing.y, Mathf.InverseLerp(50f, 100f, CurrentFieldOfView));
|
|
}
|
|
else
|
|
{
|
|
localPosition.z = Mathf.Lerp(currentHands.handsFovPosition.x, currentHands.handsFovPosition.y, Mathf.InverseLerp(50f, 100f, CurrentFieldOfView));
|
|
}
|
|
currentHands.transform.parent.localPosition = localPosition;
|
|
}
|
|
}
|
|
|
|
public void CheckVRCameraHeight()
|
|
{
|
|
if (vrWasCameraUnderwater)
|
|
{
|
|
vrWasCameraUnderwater = false;
|
|
Transform obj = ovrPlayerController.transform;
|
|
Vector3 localPosition = new Vector3(0f, VRManager.Instance.cameraHeight, 0f);
|
|
ufpsCamera.transform.parent.localPosition = localPosition;
|
|
obj.localPosition = localPosition;
|
|
}
|
|
if (ufpsCamera.transform.position.y < vrMinCameraHeight)
|
|
{
|
|
float num = ufpsCamera.transform.position.y - vrMinCameraHeight;
|
|
Transform obj2 = ovrPlayerController.transform;
|
|
Vector3 localPosition2 = new Vector3(0f, ufpsCamera.transform.parent.localPosition.y - num, 0f);
|
|
ufpsCamera.transform.parent.localPosition = localPosition2;
|
|
obj2.localPosition = localPosition2;
|
|
vrWasCameraUnderwater = true;
|
|
}
|
|
}
|
|
|
|
public void ChangeVRCameraHeight(Vector3 cameraPos)
|
|
{
|
|
Transform obj = ovrPlayerController.transform;
|
|
ufpsCamera.transform.parent.localPosition = cameraPos;
|
|
obj.localPosition = cameraPos;
|
|
}
|
|
|
|
public void ChangeVRCameraHeight(float cameraHeight)
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
float y = cameraHeight + ufpsCamera.PositionOffset.y - playerHeight;
|
|
float num = ufpsCamera.transform.position.y - transform.position.y;
|
|
if (num < 1.3f)
|
|
{
|
|
}
|
|
Transform obj = ovrPlayerController.transform;
|
|
Vector3 localPosition = new Vector3(0f, y, 0f);
|
|
ufpsCamera.transform.parent.localPosition = localPosition;
|
|
obj.localPosition = localPosition;
|
|
}
|
|
}
|
|
|
|
public IEnumerator ChangeEquipmentSet(int setId)
|
|
{
|
|
if ((bool)GlobalSettings.Instance && setId != GlobalSettings.Instance.equipmentManager.currentEquipmentSetId && (CanChangeEquipment() || ((bool)currentHands.fishingRod && currentHands.fishingRod.isOnRodStand)) && !IsSetOnStand(setId))
|
|
{
|
|
Debug.Log("ChangeEquipmentSet " + setId);
|
|
gameController.hudManager.FadeDark(1f, 0.2f);
|
|
yield return new WaitForSeconds(0.4f);
|
|
GlobalSettings.Instance.equipmentManager.ChangeCurrentEquipmentSet(setId);
|
|
ChangeHands(setId);
|
|
currentHands.equipmentSetId = setId;
|
|
ResetFishing();
|
|
GlobalSettings.Instance.equipmentManager.EquipmentChanged(EquipmentObject.EquipmentType.COUNT);
|
|
yield return null;
|
|
yield return null;
|
|
StartCoroutine(currentHands.ChangeEquipment());
|
|
gameController.hudManager.FadeDark(0f, 0.3f);
|
|
}
|
|
}
|
|
|
|
public bool IsSetOnStand(int setId)
|
|
{
|
|
FishingHands fishingHands = allFishingHands[setId];
|
|
if ((bool)fishingHands.fishingRod && fishingHands.fishingRod.isOnRodStand)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public bool IsCurrentSetOnStand()
|
|
{
|
|
return IsSetOnStand(GlobalSettings.Instance.equipmentManager.currentEquipmentSetId);
|
|
}
|
|
|
|
public void ChangeFreeCamera(bool turnOn)
|
|
{
|
|
freeCamera.enabled = turnOn;
|
|
characteController.enabled = !turnOn;
|
|
ufpsController.enabled = !turnOn;
|
|
ufpsInput.enabled = !turnOn;
|
|
if (!VRManager.IsVROn())
|
|
{
|
|
ufpsCamera.enabled = !turnOn;
|
|
}
|
|
currentHands.gameObject.SetActive(!turnOn);
|
|
ufpsCamera.GetComponent<UnderwaterIME>().EffectEnabled = turnOn;
|
|
base.enabled = !turnOn;
|
|
if (turnOn)
|
|
{
|
|
currentHands.ShowRopes(false);
|
|
return;
|
|
}
|
|
currentHands.ShowRopes(true);
|
|
StartCoroutine(gameController.ResetPlayer(false));
|
|
}
|
|
|
|
[Button]
|
|
public void MoveToSpawnPoint()
|
|
{
|
|
GameObject gameObject = MultiTags.FindGameObjectsWithMultiTag("SPAWN_POINT")[0];
|
|
transform.position = gameObject.transform.position;
|
|
transform.rotation = gameObject.transform.rotation;
|
|
}
|
|
|
|
[Button]
|
|
public void SitDownKayak()
|
|
{
|
|
SitDown(1.4f, false);
|
|
}
|
|
|
|
public bool IsTrolling()
|
|
{
|
|
if (currentState == PlayerState.DRIVING_BOAT)
|
|
{
|
|
return true;
|
|
}
|
|
if ((bool)boatSimulator && boatSimulator.keepMovingForward)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void UpdateVRHands()
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
if (VRManager.Instance.isOculusDashboardOn || HUDManager.Instance.currentHudState == HUDManager.HUDState.PAUSE)
|
|
{
|
|
return;
|
|
}
|
|
if (vrHandsParent.parent == transform && VRManager.Instance.IsVRHoldRod() && (bool)VRControllersManager.Instance.GetVRController(VRControllersManager.Instance.GetPrimaryController()))
|
|
{
|
|
if ((bool)currentHands.fishingRod && currentHands.fishingRod.isOnRodStand)
|
|
{
|
|
return;
|
|
}
|
|
if (vrChangeRopeParent)
|
|
{
|
|
currentHands.currentRope.transform.parent = null;
|
|
}
|
|
vrHandsParent.parent = VRControllersManager.Instance.GetVRController(VRControllersManager.Instance.GetPrimaryController()).rodHoldTransform;
|
|
vrHandsParent.localScale = Vector3.one * vrHandsScale;
|
|
vrHandsParent.localPosition = new Vector3(0.134f, 0.376f, 0.128f);
|
|
vrHandsParent.localEulerAngles = new Vector3(20f, 180f, 0f);
|
|
vrHandsParent.parent = transform;
|
|
if (vrChangeRopeParent)
|
|
{
|
|
currentHands.currentRope.transform.parent = currentHands.transform;
|
|
if (vrUpdateRopePosition)
|
|
{
|
|
currentHands.currentRope.transform.position = currentHands.fishingRod.rodMegaAttachPosition.position;
|
|
}
|
|
}
|
|
if (!GameController.Instance.iceLevel)
|
|
{
|
|
currentHands.fishingRod.transform.localScale = new Vector3((!VRControllersManager.Instance.IsLeftHanded()) ? currentHands.fishingRod.transform.localScale.y : (0f - currentHands.fishingRod.transform.localScale.y), currentHands.fishingRod.transform.localScale.y, currentHands.fishingRod.transform.localScale.z);
|
|
currentHands.fishingRod.reelMountPosition.localScale = new Vector3(1f, 1f, (!VRControllersManager.Instance.IsLeftHanded()) ? 1f : (-1f));
|
|
}
|
|
}
|
|
else if (vrHandsParent.parent != transform && !VRManager.Instance.vrHoldRod)
|
|
{
|
|
vrHandsParent.parent = transform;
|
|
vrHandsParent.localScale = Vector3.one;
|
|
vrHandsParent.localPosition = new Vector3(0f, 1.5f, 0f);
|
|
vrHandsParent.localEulerAngles = new Vector3(0f, 0f, 0f);
|
|
}
|
|
else if (!VRManager.Instance.IsControllersInput())
|
|
{
|
|
vrHandsParent.localScale = Vector3.one * vrHandsScale;
|
|
if (gameController.iceLevel)
|
|
{
|
|
if (currentState == PlayerState.ICE_FISHING)
|
|
{
|
|
vrHandsParent.localPosition = new Vector3(0f, 1f, -0.35f);
|
|
}
|
|
else
|
|
{
|
|
vrHandsParent.localPosition = new Vector3(0f, 1.5f, 0f);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
vrHandsParent.localPosition = new Vector3(0f, 1.5f, -0.1f);
|
|
}
|
|
vrHandsParent.position = new Vector3(ufpsCamera.transform.position.x, vrHandsParent.position.y, ufpsCamera.transform.position.z);
|
|
}
|
|
}
|
|
currentHands.currentRope.transform.localScale = Vector3.one;
|
|
}
|
|
|
|
public void UpdateVRHUD()
|
|
{
|
|
if (!VRManager.IsVROn() || !ufpsCamera)
|
|
{
|
|
return;
|
|
}
|
|
HUDManager.Instance.transform.localPosition = vrHUDOffset;
|
|
vrHUDParent.position = ufpsCamera.transform.position;
|
|
if (VRManager.Instance.hudRotateStyle == VRManager.HUDRotateStyle.NONE)
|
|
{
|
|
return;
|
|
}
|
|
if (VRManager.Instance.hudRotateStyle == VRManager.HUDRotateStyle.FREE)
|
|
{
|
|
vrHUDParent.eulerAngles = new Vector3(0f, ufpsCamera.transform.eulerAngles.y, 0f);
|
|
}
|
|
else
|
|
{
|
|
if (VRManager.Instance.hudRotateStyle != VRManager.HUDRotateStyle.STEP || vrHUDRotationTween != null)
|
|
{
|
|
return;
|
|
}
|
|
float num = Mathf.Abs(Mathf.DeltaAngle(vrHUDParent.eulerAngles.y, ufpsCamera.transform.eulerAngles.y));
|
|
vrHUDRotationThreshold = Mathf.Lerp(50f, 70f, Mathf.InverseLerp(VRManager.Instance.hudSizeMinMax.x, VRManager.Instance.hudSizeMinMax.y, VRManager.Instance.hudSize));
|
|
if (num > vrHUDRotationThreshold || vrHUDFreeIsRotating)
|
|
{
|
|
vrHUDParent.rotation = Quaternion.RotateTowards(vrHUDParent.rotation, ufpsCamera.transform.rotation, vrHUDRotationSpeed * num * Time.deltaTime);
|
|
vrHUDParent.eulerAngles = new Vector3(0f, vrHUDParent.eulerAngles.y, 0f);
|
|
vrHUDFreeIsRotating = true;
|
|
if (num < 10f)
|
|
{
|
|
vrHUDFreeIsRotating = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
[Button]
|
|
public void GetForwardVectorTEST()
|
|
{
|
|
Debug.LogError("GetForwardVectorTEST: " + GetForwardVector());
|
|
Debug.DrawLine(ufpsCamera.transform.position, ufpsCamera.transform.position + GetForwardVector(), Color.red, 8f);
|
|
}
|
|
|
|
public Vector3 GetForwardVector()
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
Vector3 vector = new Vector3(ufpsCamera.transform.forward.x, 0f, ufpsCamera.transform.forward.z);
|
|
return vector.normalized;
|
|
}
|
|
return transform.forward;
|
|
}
|
|
|
|
public void UpdateRoomscale()
|
|
{
|
|
}
|
|
}
|