1149 lines
39 KiB
C#
1149 lines
39 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BitStrap;
|
|
using UnityEngine;
|
|
|
|
public class FishingController : MonoBehaviour
|
|
{
|
|
[HideInInspector]
|
|
public FishingPlayer fishingPlayer;
|
|
|
|
[HideInInspector]
|
|
public FishingHands fishingHands;
|
|
|
|
public bool testNewPullForce;
|
|
|
|
public bool castCameraDir = true;
|
|
|
|
public Vector3 throwVector = new Vector3(0f, 0f, 10f);
|
|
|
|
public Vector3 throwNearVector = new Vector3(0f, 1f, 10f);
|
|
|
|
public Vector3 throwFlyVector = new Vector3(0f, 0f, 10f);
|
|
|
|
public Vector3 throwExplosiveVector = new Vector3(0f, 0f, 0f);
|
|
|
|
[ReadOnly]
|
|
public float throwStrength;
|
|
|
|
[ReadOnly]
|
|
public float currentThrowStrength01;
|
|
|
|
public float throwStrengthMin = 200f;
|
|
|
|
public float throwStrengthMax = 500f;
|
|
|
|
public float throwStrengthNear = 1500f;
|
|
|
|
public float throwStrengthSpeed = 10f;
|
|
|
|
public float throwStrengthFloatFactor = 0.85f;
|
|
|
|
public float throwStrengthFlyFactor = 0.8f;
|
|
|
|
public float throwStrengthFactor = 1f;
|
|
|
|
[ReadOnly]
|
|
public bool throwStrengthDir = true;
|
|
|
|
public float throwStrengthExplosive = 100f;
|
|
|
|
[ReadOnly]
|
|
public bool canThrowNear = true;
|
|
|
|
public float catchAreaRadius = 4f;
|
|
|
|
public float netAreaRadius = 1f;
|
|
|
|
[ReadOnly]
|
|
public bool fishCanBePulled;
|
|
|
|
[ReadOnly]
|
|
public bool fishCanBePulledNet;
|
|
|
|
public float fishLineForceFactor = 1f;
|
|
|
|
public float iceFishingSitHeight = 0.9f;
|
|
|
|
public float iceFishingLookHeight = 0.6f;
|
|
|
|
[ReadOnly]
|
|
public bool isCastingFly;
|
|
|
|
public float flyCastDuration = 4f;
|
|
|
|
[ReadOnly]
|
|
public float flyCastTimer;
|
|
|
|
public float distanceToHoleBottomCenter;
|
|
|
|
public static float baitHitWaterTimer = -1f;
|
|
|
|
public float vrThrowStrengthMultiplier = 180f;
|
|
|
|
public bool vrUseSideCast = true;
|
|
|
|
public List<Vector3> vrThrowDirHistory = new List<Vector3>();
|
|
|
|
public float vrThrowDirHistoryTimer;
|
|
|
|
public float vrThrowDirHistoryDelay = 0.05f;
|
|
|
|
public int vrThrowDirHistoryPast;
|
|
|
|
public bool vrThrowHistoryUseAvg;
|
|
|
|
public bool vrThrowHistoryUseZeroY;
|
|
|
|
public Vector3 vrThrowWMROffset = Vector3.zero;
|
|
|
|
[ReadOnly]
|
|
public Vector3 vrThrowWMROffsetSide = Vector3.zero;
|
|
|
|
public Vector3 vrThrowWMRMultiplier = Vector3.one;
|
|
|
|
public float vrThrowWMRMinY = 1.5f;
|
|
|
|
public float fishInNetAreaTimer;
|
|
|
|
private void Awake()
|
|
{
|
|
fishingPlayer = GetComponent<FishingPlayer>();
|
|
if (VRManager.IsVROn())
|
|
{
|
|
iceFishingSitHeight = 1.4f;
|
|
}
|
|
}
|
|
|
|
public void UpdateFishing()
|
|
{
|
|
if (!fishingPlayer.allowFishing || !fishingPlayer.isHandsCameraVisible || Time.deltaTime == 0f)
|
|
{
|
|
return;
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("RESET_THROW") && (!VRManager.IsVROn() || GameController.Instance.fightTest || !fishingPlayer.fish || fishingPlayer.fish.isInNetArea) && fishingHands.baitWasThrown && !fishingHands.fishingRod.isOnRodStand && fishingHands.ThrowObjectOnWater() && fishingHands.updateLeftArmPos)
|
|
{
|
|
FinishFishing();
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("ZOOM") && !Input.GetKey(KeyCode.LeftControl) && !fishingPlayer.underwaterCamera.isTurnedOn && (!fishingPlayer.fish || fishingPlayer.fish.isTryingBait) && !fishingPlayer.junk)
|
|
{
|
|
fishingPlayer.Zoom(fishingPlayer.ZoomFieldOfView == 1f, 0.4f, fishingPlayer.playersZoom);
|
|
}
|
|
if (fishingPlayer.boatSimulator != null && UtilitiesInput.GetButtonDown("BOAT_DRIVE") && (!fishingHands.baitWasThrown || fishingHands.fishingRod.isOnRodStand))
|
|
{
|
|
StartCoroutine(fishingPlayer.DriveBoat(true));
|
|
}
|
|
if ((GlobalSettings.Instance == null || ((bool)GlobalSettings.Instance && GlobalSettings.Instance.turnOnCheats)) && Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.N))
|
|
{
|
|
fishingPlayer.ChangeState(FishingPlayer.PlayerState.FISHING_NET);
|
|
}
|
|
FishCanBePulled();
|
|
if (baitHitWaterTimer > 0f)
|
|
{
|
|
baitHitWaterTimer -= Time.deltaTime;
|
|
}
|
|
if (fishingPlayer.currentHands.fishingRod.isOnRodStand)
|
|
{
|
|
return;
|
|
}
|
|
if ((UtilitiesInput.isReelingIn || UtilitiesInput.isReelingOut) && !fishingHands.reel.isDragActive)
|
|
{
|
|
fishingHands.reel.SetDragActive(true);
|
|
}
|
|
if (!fishingHands.baitWasThrown && !fishingHands.currentBoilie)
|
|
{
|
|
if (fishingHands.hasRequiredEquipments && !fishingHands.isThrowingNear)
|
|
{
|
|
if (UtilitiesInput.GetButtonDown("THROW_NEAR") && !fishingPlayer.currentHands.isFlyRig && canThrowNear && fishingPlayer.ufpsInput.AllowGameplayInput && !TutorialManager.Instance.helpBlockNearThrow)
|
|
{
|
|
if ((bool)fishingPlayer.boatSimulator)
|
|
{
|
|
fishingPlayer.boatSimulator.PauseFloating(true);
|
|
}
|
|
fishingHands.ShowRopes(true);
|
|
fishingPlayer.ufpsController.Stop();
|
|
fishingPlayer.ufpsInput.AllowGameplayInput = false;
|
|
fishingPlayer.BlockMouseLook(false, 0.5f);
|
|
fishingPlayer.ufpsWeapon.RotationSpringStiffness = 0.05f;
|
|
fishingPlayer.allowRun = false;
|
|
fishingPlayer.ufpsController.MotorAcceleration = (fishingPlayer.currentMotorAcceleration = fishingPlayer.motorAccelerationValues.y);
|
|
fishingPlayer.fishingStartPosition = base.transform.position;
|
|
fishingPlayer.gameController.hudManager.ShowHudFishing(true);
|
|
fishingHands.ThrowNear();
|
|
return;
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("THROW_FAR") && fishingPlayer.ufpsInput.AllowGameplayInput && !TutorialManager.Instance.helpBlockFarThrow && !fishingHands.leftArm.activeSelf && (!VRManager.IsVROn() || !FishingHands.rodStand || !FishingHands.rodStand.IsSeeingAnyRod()))
|
|
{
|
|
fishingHands.ShowRopes(true);
|
|
fishingPlayer.baitCanBeThrown = false;
|
|
isCastingFly = false;
|
|
fishingPlayer.ufpsController.Stop();
|
|
throwStrength = throwStrengthMin;
|
|
currentThrowStrength01 = 0f;
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
throwStrengthFactor = 0.7f;
|
|
if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.STRENGTH_1).isUnlocked)
|
|
{
|
|
throwStrengthFactor += 0.1f;
|
|
}
|
|
if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.STRENGTH_2).isUnlocked)
|
|
{
|
|
throwStrengthFactor += 0.1f;
|
|
}
|
|
if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.STRENGTH_3).isUnlocked)
|
|
{
|
|
throwStrengthFactor += 0.1f;
|
|
}
|
|
}
|
|
fishingPlayer.allowRun = false;
|
|
fishingPlayer.ufpsController.MotorAcceleration = (fishingPlayer.currentMotorAcceleration = fishingPlayer.motorAccelerationValues.y);
|
|
fishingPlayer.ufpsInput.AllowGameplayInput = false;
|
|
fishingPlayer.BlockMouseLook(false, 0.5f);
|
|
fishingPlayer.ufpsWeapon.RotationSpringStiffness = 0.05f;
|
|
fishingPlayer.fishingStartPosition = base.transform.position;
|
|
fishingHands.isThrowing = true;
|
|
if (VRManager.IsVROn() && (bool)FishingHands.rodStand && FishingHands.rodStand.gameObject.activeSelf)
|
|
{
|
|
fishingPlayer.gameController.hudManager.HideMessage();
|
|
}
|
|
if (VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
fishingPlayer.baitCanBeThrown = true;
|
|
fishingPlayer.gameController.hudManager.ShowHudFishing(true);
|
|
vrThrowDirHistory.Clear();
|
|
vrThrowDirHistory.Add(OVRInput.GetLocalControllerVelocity(VRControllersManager.Instance.GetPrimaryController()));
|
|
vrThrowDirHistoryTimer = Time.time + vrThrowDirHistoryDelay;
|
|
}
|
|
else
|
|
{
|
|
StartCoroutine(fishingHands.StartFishing());
|
|
}
|
|
}
|
|
if (fishingPlayer.baitCanBeThrown)
|
|
{
|
|
if (VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
if (UtilitiesInput.GetButtonUp("THROW_FAR") || (VRManager.Instance.vrCastOnPress && UtilitiesInput.GetButtonDown("THROW_FAR")))
|
|
{
|
|
fishingHands.ThrowBait();
|
|
if (fishingHands.isFlyRig)
|
|
{
|
|
fishingHands.CreateFlyArmJoint(currentThrowStrength01);
|
|
fishingHands.fishingRod.ShowReelLine(true);
|
|
fishingPlayer.baitCanBeThrown = false;
|
|
}
|
|
}
|
|
else if (UtilitiesInput.GetButton("THROW_FAR") && Time.time >= vrThrowDirHistoryTimer)
|
|
{
|
|
vrThrowDirHistory.Add(OVRInput.GetLocalControllerVelocity(VRControllersManager.Instance.GetPrimaryController()));
|
|
vrThrowDirHistoryTimer = Time.time + vrThrowDirHistoryDelay;
|
|
}
|
|
}
|
|
else if (UtilitiesInput.GetButton("THROW_FAR"))
|
|
{
|
|
UpdateThrowStrength();
|
|
fishingPlayer.gameController.hudManager.ShowHudFishing(true);
|
|
}
|
|
else
|
|
{
|
|
if ((bool)fishingPlayer.boatSimulator)
|
|
{
|
|
fishingPlayer.boatSimulator.PauseFloating(true);
|
|
}
|
|
fishingPlayer.baitCanBeThrown = false;
|
|
fishingHands.fishingLine.currentThrowStrength01 = currentThrowStrength01;
|
|
if (!fishingHands.isFlyRig)
|
|
{
|
|
fishingHands.throwObject.transform.position = fishingHands.fishingRod.baitThrowPosition.position;
|
|
fishingHands.currentRope.regenerateRope(true);
|
|
fishingHands.Throw(currentThrowStrength01);
|
|
}
|
|
else
|
|
{
|
|
if (VRManager.IsVROn())
|
|
{
|
|
fishingHands.Throw(currentThrowStrength01);
|
|
}
|
|
fishingHands.CreateFlyArmJoint(currentThrowStrength01);
|
|
fishingHands.fishingRod.ShowReelLine(true);
|
|
}
|
|
fishingPlayer.gameController.hudManager.ShowHudFishing(true);
|
|
fishingPlayer.gameController.hudManager.hudFishing.ShowThrowSlider(false);
|
|
fishingPlayer.TurnOnSpring(false);
|
|
}
|
|
}
|
|
else if (isCastingFly)
|
|
{
|
|
flyCastTimer += Time.deltaTime;
|
|
fishingPlayer.gameController.hudManager.hudFishing.UpdateFlyCast(flyCastTimer / flyCastDuration);
|
|
if (flyCastTimer >= flyCastDuration)
|
|
{
|
|
fishingPlayer.gameController.hudManager.hudFishing.ShowFlyCastSlider(false);
|
|
isCastingFly = false;
|
|
flyCastTimer = 0f;
|
|
FinishFishing();
|
|
fishingPlayer.gameController.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/CAST_NOT_PRESSED"));
|
|
Debug.Log("StopFlyCasting");
|
|
}
|
|
else if (UtilitiesInput.GetButtonDown("THROW_FAR"))
|
|
{
|
|
fishingHands.StartFlyCasting();
|
|
fishingPlayer.gameController.hudManager.hudFishing.ShowFlyCastSlider(false);
|
|
isCastingFly = false;
|
|
Debug.Log("StartFlyCasting");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (fishingPlayer.HasFishOnCurrentRod())
|
|
{
|
|
fishingPlayer.PlayerFishStrengthDiff = fishingPlayer.GetCurrentStrength() - fishingPlayer.fish.GetCurrentStrengthFactor();
|
|
if (fishingHands.reel.GetDragForce() == 0f)
|
|
{
|
|
fishingPlayer.DragFishStrengthDiff = -1f;
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.DragFishStrengthDiff = fishingHands.reel.GetDragForce() - fishingPlayer.fish.GetCurrentStrengthFactor();
|
|
}
|
|
if (fishCanBePulled && !fishingPlayer.fish.isWatchingFish)
|
|
{
|
|
fishingPlayer.fish.ChangeUpdateToBait(false);
|
|
fishingPlayer.gameController.hudManager.ShowNetFishCursor(fishingPlayer.fish.useFishingNet && fishCanBePulledNet && fishingPlayer.fish.watchStyle == Fish.WatchStyle.HANDS);
|
|
bool flag = !GlobalSettings.Instance || GlobalSettings.Instance.equipmentManager.FindEquipment(EquipmentObject.EquipmentType.OTHER, "FISHING_NET_01").isBought;
|
|
if (GameController.Instance.manualFishingNet && VRManager.Instance.IsVRFishingNet())
|
|
{
|
|
if (fishingPlayer.gameController.hudManager.cursorNetFish.gameObject.activeSelf)
|
|
{
|
|
VRControllersManager.Instance.UpdateButtonInfo(VRInputManager.Instance.FindAction("NET_START"), Utilities.GetTranslation("VR_OPTIONS/VR_FISHING_NET"));
|
|
}
|
|
else
|
|
{
|
|
VRControllersManager.Instance.UpdateButtonInfo(VRInputManager.Instance.FindAction("NET_START"), string.Empty);
|
|
}
|
|
}
|
|
bool flag2 = fishingPlayer.fish.watchStyle == Fish.WatchStyle.HANDS;
|
|
if (!flag2)
|
|
{
|
|
fishingPlayer.FishCatch();
|
|
}
|
|
if (flag2 && fishCanBePulledNet)
|
|
{
|
|
if (!flag)
|
|
{
|
|
fishingPlayer.LineBreak(Utilities.GetTranslation("HUD_MESSAGE/NO_NET"), 0f);
|
|
return;
|
|
}
|
|
if (GameController.Instance.manualFishingNet && UtilitiesInput.GetButtonDown("NET_START"))
|
|
{
|
|
fishingPlayer.ChangeState(FishingPlayer.PlayerState.FISHING_NET);
|
|
}
|
|
else if (!GameController.Instance.manualFishingNet)
|
|
{
|
|
fishingPlayer.ChangeState(FishingPlayer.PlayerState.FISHING_NET);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.gameController.hudManager.ShowPullFishCursor(false);
|
|
fishingPlayer.gameController.hudManager.ShowNetFishCursor(false);
|
|
}
|
|
if (UtilitiesInput.isReelingIn || UtilitiesInput.GetButtonDown("PUMP"))
|
|
{
|
|
if ((bool)fishingPlayer.fish && !fishingPlayer.fish.isJerked && (fishingPlayer.fish.jerkTimer < Fish.jerkDurationThreshold || GameController.Instance.fightTest))
|
|
{
|
|
MakeFirstJerk();
|
|
}
|
|
if ((bool)fishingPlayer.boatSimulator && fishingPlayer.boatSimulator.keepMovingForward)
|
|
{
|
|
fishingPlayer.boatSimulator.StopKeepMoving();
|
|
}
|
|
}
|
|
if (!fishingPlayer.HasFishOnCurrentRod())
|
|
{
|
|
return;
|
|
}
|
|
fishingPlayer.wasJustJerked = false;
|
|
if (UtilitiesInput.GetButtonDown("PUMP") && !VRManager.Instance.IsControllersInput())
|
|
{
|
|
fishingHands.JerkPump(true);
|
|
if (!fishingPlayer.fish.isJerked)
|
|
{
|
|
fishingHands.jerkCanBeStopped = false;
|
|
fishingPlayer.fish.isJerked = true;
|
|
}
|
|
fishingPlayer.wasJustJerked = true;
|
|
}
|
|
else if (UtilitiesInput.GetButtonUp("PUMP"))
|
|
{
|
|
fishingHands.JerkPump(false);
|
|
}
|
|
fishingPlayer.fish.SetPulling((UtilitiesInput.isReelingIn && !fishingHands.fishingLine.isLoose) || fishingHands.fishingLine.currentTension > 0.2f);
|
|
if (fishingHands.fishingLine.stretchToDistance > 0.1f && fishLineForceFactor > 0f)
|
|
{
|
|
StartCoroutine(fishingPlayer.fish.PullForce(fishLineForceFactor * Time.deltaTime));
|
|
}
|
|
bool flag3 = fishingHands.fishingLine.stretchToDistance < fishingHands.FLC.ropeStretchInstantBreakThreshold * 0.85f;
|
|
if (!flag3)
|
|
{
|
|
}
|
|
if (UtilitiesInput.isReelingIn && fishingHands.fishingRod.GetThrowObjectDistance() > ((!fishingHands.fishingFloat) ? 1f : 0.25f))
|
|
{
|
|
if (!flag3)
|
|
{
|
|
if (!fishingPlayer.fish.isBeingPulled)
|
|
{
|
|
fishingPlayer.fish.ChangeUpdateToBait(false);
|
|
}
|
|
fishingPlayer.pullForce = 0.1f;
|
|
fishingHands.reel.RotateLineGuard(0.1f, true);
|
|
fishingHands.fishingLine.currentTryReelTension = 0.4f;
|
|
}
|
|
else if (!fishingHands.fishingLine.isLooseCanReel)
|
|
{
|
|
if (!fishingPlayer.fish.isInNetArea || fishingHands.fishingLine.stretchToDistance < 0.04f)
|
|
{
|
|
fishingPlayer.fish.ChangeUpdateToBait(true);
|
|
fishingPlayer.pullForce = 1f;
|
|
fishingHands.reel.RotateLineGuard(((!(fishingPlayer.PlayerFishStrengthDiff < 0.1f)) ? fishingPlayer.PlayerFishStrengthDiff : 0.1f) * 3f);
|
|
if (fishingPlayer.fish.DurabilityCurrent > Fish.DurabilityMin)
|
|
{
|
|
fishingPlayer.AddStrength((0f - Time.deltaTime) * 0.05f);
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.AddStrength((0f - Time.deltaTime) * 0.05f);
|
|
}
|
|
if (fishingHands.fishingLine.weightDurability < fishingPlayer.fish.Weight)
|
|
{
|
|
fishingHands.fishingLine.currentTryReelTension = 1f * fishingPlayer.fish.GetCurrentStrengthFactor();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (!fishingPlayer.fish.isBeingPulled)
|
|
{
|
|
fishingPlayer.fish.ChangeUpdateToBait(false);
|
|
}
|
|
fishingPlayer.pullForce = 0f;
|
|
fishingHands.reel.RotateLineGuard(1f);
|
|
fishingHands.fishingLine.currentTryReelTension = 0f;
|
|
}
|
|
}
|
|
else if (UtilitiesInput.isReelingOut)
|
|
{
|
|
if (!fishingPlayer.fish.isBeingPulled)
|
|
{
|
|
fishingPlayer.fish.ChangeUpdateToBait(false);
|
|
}
|
|
fishingPlayer.pullForce = 0f;
|
|
fishingHands.reel.RotateLineGuard(-1f);
|
|
fishingHands.fishingLine.currentTryReelTension = 0f;
|
|
}
|
|
else if (UtilitiesInput.GetButtonDown("REEL_ARCH") && !UtilitiesInput.isReelingIn && !UtilitiesInput.isReelingOut)
|
|
{
|
|
if (!fishingPlayer.fish.isBeingPulled)
|
|
{
|
|
fishingPlayer.fish.ChangeUpdateToBait(false);
|
|
}
|
|
fishingPlayer.pullForce = 0f;
|
|
fishingHands.reel.ToggleDragActive();
|
|
fishingHands.fishingLine.currentTryReelTension = 0f;
|
|
}
|
|
else
|
|
{
|
|
if (!fishingPlayer.fish.isBeingPulled)
|
|
{
|
|
fishingPlayer.fish.ChangeUpdateToBait(false);
|
|
}
|
|
fishingPlayer.pullForce = 0f;
|
|
fishingHands.reel.RotateSpool(0.4f);
|
|
fishingHands.fishingLine.currentTryReelTension = 0f;
|
|
}
|
|
if (fishingPlayer.fish.isOnGround)
|
|
{
|
|
}
|
|
Vector3 vector = new Vector3(fishingHands.fishingRod.ropeStartPosition.transform.position.x, (!(fishingPlayer.fish.transform.position.y < -0.7f)) ? 0f : (fishingHands.fishingRod.ropeStartPosition.transform.position.y + 2.5f), fishingHands.fishingRod.ropeStartPosition.transform.position.z);
|
|
fishingPlayer.pullDirection = (vector - fishingPlayer.fish.transform.position).normalized;
|
|
if (testNewPullForce)
|
|
{
|
|
fishingPlayer.fish.SetPullForce(fishingPlayer.pullDirection, fishingPlayer.pullForce * fishingHands.currentUserReelSpeed, false);
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.fish.SetPullForce(fishingPlayer.pullDirection, fishingPlayer.pullForce * fishingHands.currentReelSpeed, false);
|
|
}
|
|
fishingHands.bait.ropeRigidbody.transform.LookAt(vector);
|
|
CheckFishingDirection();
|
|
}
|
|
else if (fishingHands.updateLeftArmPos)
|
|
{
|
|
Vector3 vector2 = new Vector3(fishingHands.fishingRod.ropeStartPosition.transform.position.x, base.transform.position.y, fishingHands.fishingRod.ropeStartPosition.transform.position.z);
|
|
if (!fishingHands.ThrowObjectOnWater())
|
|
{
|
|
if (!fishingHands.isFlyRig)
|
|
{
|
|
fishingHands.reel.RotateSpool(1f);
|
|
}
|
|
}
|
|
else if (UtilitiesInput.isReelingIn)
|
|
{
|
|
if (fishingHands.currentUserReelSpeed <= 0.2f)
|
|
{
|
|
fishingHands.spinningMethodController.SpinningStateEvent(SpinningMethodController.SpinningState.MOVE_SLOW);
|
|
}
|
|
else
|
|
{
|
|
fishingHands.spinningMethodController.SpinningStateEvent(SpinningMethodController.SpinningState.MOVE_MEDIUM);
|
|
}
|
|
if (fishingHands.isFlyRig && fishingHands.updateLeftArmFly)
|
|
{
|
|
fishingHands.reel.PullFlyLine();
|
|
}
|
|
else if (!fishingHands.updateLeftArmFly)
|
|
{
|
|
fishingHands.reel.RotateLineGuard(1f);
|
|
}
|
|
if ((bool)fishingPlayer.junk && fishCanBePulled)
|
|
{
|
|
StartCoroutine(fishingPlayer.ShowCatchObject());
|
|
}
|
|
else if (!fishingPlayer.junk && fishingHands.fishingRod.GetThrowObjectDistance() < Mathf.Abs(fishingHands.baitStartPosition.x))
|
|
{
|
|
FinishFishing();
|
|
}
|
|
if ((bool)fishingPlayer.junk)
|
|
{
|
|
fishingPlayer.AddStrength((0f - Time.deltaTime) * 0.07f);
|
|
}
|
|
}
|
|
else if (UtilitiesInput.isReelingOut)
|
|
{
|
|
if (!fishingHands.isFlyRig)
|
|
{
|
|
fishingHands.reel.RotateLineGuard(-0.7f);
|
|
}
|
|
}
|
|
else if (UtilitiesInput.GetButtonDown("REEL_ARCH") && !UtilitiesInput.isReelingIn && !UtilitiesInput.isReelingOut)
|
|
{
|
|
fishingHands.reel.ToggleDragActive();
|
|
}
|
|
if (fishingHands.ThrowObjectOnWater())
|
|
{
|
|
CheckFishingDirection();
|
|
if (UtilitiesInput.GetButtonDown("PUMP"))
|
|
{
|
|
fishingHands.JerkPump(true);
|
|
}
|
|
else if (UtilitiesInput.GetButtonUp("PUMP"))
|
|
{
|
|
fishingHands.JerkPump(false);
|
|
}
|
|
}
|
|
}
|
|
if ((!fishingPlayer.fish && !fishingPlayer.junk) || fishingHands.fishingLine.looseTensionFactor > 0.8f)
|
|
{
|
|
}
|
|
fishingPlayer.CheckStrength();
|
|
}
|
|
|
|
public void UpdateIceFishing()
|
|
{
|
|
if (!fishingPlayer.isHandsCameraVisible)
|
|
{
|
|
return;
|
|
}
|
|
if (fishingPlayer.ufpsCamera.PositionOffset.y > iceFishingSitHeight)
|
|
{
|
|
fishingPlayer.ufpsCamera.PositionOffset = new Vector3(fishingPlayer.ufpsCamera.PositionOffset.x, iceFishingSitHeight, fishingPlayer.ufpsCamera.PositionOffset.z);
|
|
fishingPlayer.ufpsCamera.Refresh();
|
|
if (VRManager.IsVROn())
|
|
{
|
|
fishingPlayer.ChangeVRCameraHeight(VRManager.Instance.cameraHeight);
|
|
}
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("STOP_FISHING") && !fishingPlayer.fish && fishingHands.bait.gameObject.layer != LayerMask.NameToLayer("TransparentFX"))
|
|
{
|
|
FinishIceFishing();
|
|
fishingPlayer.gameController.hudManager.ShowHudFishing(false);
|
|
return;
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("RESET_THROW") && (!VRManager.IsVROn() || GameController.Instance.fightTest || !fishingPlayer.fish))
|
|
{
|
|
fishingPlayer.ResetFishing();
|
|
}
|
|
if (fishingPlayer.drillingController.currentHole == null)
|
|
{
|
|
return;
|
|
}
|
|
if (baitHitWaterTimer > 0f)
|
|
{
|
|
baitHitWaterTimer -= Time.deltaTime;
|
|
}
|
|
if (VRManager.Instance.IsControllersInput())
|
|
{
|
|
fishingHands.transform.localEulerAngles = Vector3.zero;
|
|
fishingHands.transform.localPosition = Vector3.zero;
|
|
}
|
|
else if (!Cursor.visible)
|
|
{
|
|
if (UtilitiesInput.lookAxis.x != 0f)
|
|
{
|
|
Vector3 localEulerAngles = fishingHands.transform.localEulerAngles + new Vector3(0f, UtilitiesInput.lookAxis.x * Time.deltaTime * 75f, 0f) * ((!GlobalSettings.Instance) ? 1f : GlobalSettings.Instance.playerSettings.mouseSensitivity);
|
|
if (localEulerAngles.y > 25f && localEulerAngles.y < 180f)
|
|
{
|
|
localEulerAngles.y = 25f;
|
|
}
|
|
else if (localEulerAngles.y < 335f && localEulerAngles.y > 180f)
|
|
{
|
|
localEulerAngles.y = 335f;
|
|
}
|
|
fishingHands.transform.localEulerAngles = localEulerAngles;
|
|
}
|
|
if (UtilitiesInput.lookAxis.y != 0f)
|
|
{
|
|
Vector3 localPosition = fishingHands.transform.localPosition + new Vector3(0f, UtilitiesInput.lookAxis.y * Time.deltaTime * 0.54f, UtilitiesInput.lookAxis.y * Time.deltaTime * 0.31f) * ((!GlobalSettings.Instance) ? 1f : GlobalSettings.Instance.playerSettings.invertYAxis) * ((!GlobalSettings.Instance) ? 1f : GlobalSettings.Instance.playerSettings.mouseSensitivity);
|
|
if (localPosition.y > 0f)
|
|
{
|
|
localPosition.y = 0f;
|
|
}
|
|
else if (localPosition.y < -0.35f)
|
|
{
|
|
localPosition.y = -0.35f;
|
|
}
|
|
if (localPosition.z > 0f)
|
|
{
|
|
localPosition.z = 0f;
|
|
}
|
|
else if (localPosition.z < -0.2f)
|
|
{
|
|
localPosition.z = -0.2f;
|
|
}
|
|
fishingHands.transform.localPosition = localPosition;
|
|
}
|
|
}
|
|
distanceToHoleBottomCenter = Vector3.Distance(fishingPlayer.drillingController.currentHole.centerDown, fishingHands.bait.transform.position);
|
|
float num = Vector3.Distance(fishingPlayer.drillingController.currentHole.holeCenter.position, fishingHands.bait.transform.position);
|
|
if ((bool)fishingPlayer.drillingController.currentHole.aroundHoleCollider)
|
|
{
|
|
fishingPlayer.drillingController.currentHole.aroundHoleCollider.enabled = !fishingPlayer.fish;
|
|
}
|
|
if ((bool)fishingPlayer.fish)
|
|
{
|
|
fishingPlayer.PlayerFishStrengthDiff = fishingPlayer.GetCurrentStrength() - fishingPlayer.fish.GetCurrentStrengthFactor();
|
|
fishingPlayer.DragFishStrengthDiff = fishingHands.reel.GetDragForce() - fishingPlayer.fish.GetCurrentStrengthFactor();
|
|
bool flag = fishingPlayer.PlayerFishStrengthDiff > 0f;
|
|
bool flag2 = fishingPlayer.PlayerFishStrengthDiff > -0.2f;
|
|
fishingPlayer.wasJustJerked = false;
|
|
if (UtilitiesInput.isReelingIn)
|
|
{
|
|
fishingPlayer.fish.isJerked = true;
|
|
fishingPlayer.wasJustJerked = true;
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("PUMP"))
|
|
{
|
|
if (flag2 || !fishingPlayer.fish.isJerked)
|
|
{
|
|
fishingHands.JerkPump(true);
|
|
fishingPlayer.fish.isJerked = true;
|
|
fishingPlayer.wasJustJerked = true;
|
|
}
|
|
else
|
|
{
|
|
StartCoroutine(fishingHands.SmallJerk());
|
|
}
|
|
}
|
|
else if (UtilitiesInput.GetButtonUp("PUMP"))
|
|
{
|
|
fishingHands.JerkPump(false);
|
|
}
|
|
fishingPlayer.fish.SetPulling(UtilitiesInput.isReelingIn && !fishingHands.fishingLine.isLoose);
|
|
if (UtilitiesInput.isReelingIn)
|
|
{
|
|
fishingPlayer.pullForce += Time.deltaTime * fishingPlayer.pullSpeed;
|
|
if (fishingPlayer.pullForce > fishingPlayer.maxPullForce)
|
|
{
|
|
fishingPlayer.pullForce = fishingPlayer.maxPullForce;
|
|
}
|
|
fishingHands.reel.RotateLineGuard(1f);
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.pullForce = 0f;
|
|
}
|
|
if (UtilitiesInput.isReelingIn && distanceToHoleBottomCenter <= 1f && !fishingPlayer.fish.isWatchingFish)
|
|
{
|
|
Debug.Log("FISH_PULL");
|
|
fishingPlayer.fish.isWatchingFish = true;
|
|
fishingPlayer.fish.CheckBehaviorDistance();
|
|
fishingPlayer.fish.DisableAI();
|
|
fishingPlayer.fish.gameObject.transform.position = fishingPlayer.drillingController.currentHole.centerDown;
|
|
fishingPlayer.FishCatch();
|
|
return;
|
|
}
|
|
if (!fishingPlayer.fish.isWatchingFish)
|
|
{
|
|
fishingPlayer.pullDirection = (fishingPlayer.drillingController.currentHole.centerDown - fishingPlayer.fish.transform.position).normalized;
|
|
fishingPlayer.fish.SetPullForce(fishingPlayer.pullDirection, fishingPlayer.pullForce / fishingPlayer.maxPullForce, false);
|
|
fishingHands.reel.RotateSpool(0.4f);
|
|
}
|
|
if (UtilitiesInput.isReelingIn)
|
|
{
|
|
if (fishingPlayer.fish.DurabilityCurrent > Fish.DurabilityMin)
|
|
{
|
|
fishingPlayer.AddStrength((0f - Time.deltaTime) * 0.06f);
|
|
}
|
|
else
|
|
{
|
|
fishingPlayer.AddStrength((0f - Time.deltaTime) * 0.045f);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ((UtilitiesInput.isReelingIn || (UtilitiesInput.isReelingOut && CanLowerIceLine())) && fishingHands.hasRequiredEquipments)
|
|
{
|
|
if (UtilitiesInput.isReelingIn)
|
|
{
|
|
if (fishingHands.fishingLine.CanReelIn())
|
|
{
|
|
fishingHands.reel.RotateLineGuard(1f);
|
|
}
|
|
}
|
|
else if (UtilitiesInput.isReelingOut)
|
|
{
|
|
fishingPlayer.isIceBaitReseted = false;
|
|
fishingHands.reel.RotateLineGuard(-0.7f);
|
|
}
|
|
if ((bool)fishingPlayer.junk && fishingHands.fishingRod.GetThrowObjectDistance() < 1f)
|
|
{
|
|
CheckObjectSize();
|
|
}
|
|
if (UtilitiesInput.isReelingIn && num <= 0.2f && !fishingPlayer.isIceBaitReseted && (bool)fishingPlayer.junk)
|
|
{
|
|
StartCoroutine(fishingPlayer.ShowCatchObject());
|
|
}
|
|
if ((bool)fishingPlayer.junk && UtilitiesInput.isReelingIn)
|
|
{
|
|
fishingPlayer.AddStrength((0f - Time.deltaTime) * 0.07f);
|
|
}
|
|
}
|
|
if (UtilitiesInput.GetButtonDown("PUMP"))
|
|
{
|
|
fishingHands.JerkPump(true);
|
|
}
|
|
else if (UtilitiesInput.GetButtonUp("PUMP"))
|
|
{
|
|
fishingHands.JerkPump(false);
|
|
}
|
|
}
|
|
if (fishingHands.bait.transform.position.y > -1f && fishingHands.currentRope.getSegmentProperties().length > 0.2f)
|
|
{
|
|
fishingHands.currentRope.getSegmentProperties().length = 0.2f;
|
|
fishingHands.currentRope.regenerateRope(false);
|
|
}
|
|
else if (fishingHands.bait.transform.position.y < -1f && fishingHands.currentRope.getSegmentProperties().length == 0.2f)
|
|
{
|
|
fishingHands.currentRope.getSegmentProperties().length = 0.75f;
|
|
fishingHands.currentRope.regenerateRope(false);
|
|
}
|
|
fishingPlayer.CheckStrength();
|
|
}
|
|
|
|
public void ThrowBait(bool throwNear)
|
|
{
|
|
if (!fishingPlayer.gameController.iceLevel)
|
|
{
|
|
fishingHands.currentRope.transform.parent = fishingHands.transform;
|
|
if ((bool)fishingHands.fishingFloat)
|
|
{
|
|
fishingHands.fishingFloat.ThrowFloat();
|
|
}
|
|
fishingHands.bait.ThrowBait();
|
|
fishingHands.ChangeRopesRadius(true);
|
|
Vector3 vector = ((!castCameraDir) ? base.transform.forward : fishingPlayer.ufpsCamera.transform.forward);
|
|
Debug.DrawLine(fishingHands.throwFakeObject.transform.position, fishingHands.throwFakeObject.transform.position + vector, Color.red, 5f);
|
|
if (VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
Debug.Log("GetLocalControllerVelocity" + OVRInput.GetLocalControllerVelocity(VRControllersManager.Instance.GetPrimaryController()));
|
|
Debug.Log("GetLocalControllerAngularVelocity" + OVRInput.GetLocalControllerAngularVelocity(VRControllersManager.Instance.GetPrimaryController()));
|
|
if (vrThrowHistoryUseAvg)
|
|
{
|
|
Vector3 zero = Vector3.zero;
|
|
int num = 0;
|
|
for (int i = 0; i < vrThrowDirHistoryPast && i < vrThrowDirHistory.Count; i++)
|
|
{
|
|
zero += vrThrowDirHistory[vrThrowDirHistory.Count - 1 - i];
|
|
num++;
|
|
}
|
|
zero /= (float)num;
|
|
vector = fishingPlayer.transform.rotation * zero;
|
|
}
|
|
else
|
|
{
|
|
int index = vrThrowDirHistory.Count - vrThrowDirHistoryPast - 1;
|
|
Debug.Log("vrThrowDirHistory[historyStamp]: " + vrThrowDirHistory[index]);
|
|
if (VRManager.GetControllerType(true) == OVRInput.OpenVRController.WindowsMRController)
|
|
{
|
|
Vector2 vector2 = new Vector2(vrThrowDirHistory[index].x, vrThrowDirHistory[index].z);
|
|
float magnitude = vector2.magnitude;
|
|
float num2 = Mathf.Lerp(vrThrowWMRMultiplier.x, vrThrowWMRMultiplier.z, Mathf.InverseLerp(2f, 5f, magnitude));
|
|
Debug.Log("forwardStrength: " + num2 + " vrThrowDirHistory[historyStamp].z).magnitude: " + magnitude);
|
|
if (magnitude > 1.5f)
|
|
{
|
|
vrThrowDirHistory[index] += vrThrowWMROffset;
|
|
vrThrowDirHistory[index] = Vector3.Scale(vrThrowDirHistory[index], new Vector3(num2, vrThrowWMRMultiplier.y, num2));
|
|
}
|
|
if (vrThrowDirHistory[index].y < vrThrowWMRMinY && magnitude > 1.5f)
|
|
{
|
|
Vector3 value = vrThrowDirHistory[index];
|
|
value.y = vrThrowWMRMinY;
|
|
vrThrowDirHistory[index] = value;
|
|
}
|
|
Debug.Log("vrThrowDirHistory[historyStamp] 2: " + vrThrowDirHistory[index]);
|
|
}
|
|
vector = fishingPlayer.transform.rotation * vrThrowDirHistory[index];
|
|
}
|
|
if (vrThrowHistoryUseZeroY)
|
|
{
|
|
vector.y = Mathf.Clamp(vector.y, 0f, 666f);
|
|
}
|
|
}
|
|
else if (fishingHands.isFlyRig)
|
|
{
|
|
vector *= throwFlyVector.z;
|
|
vector.y += throwFlyVector.y;
|
|
vector += base.transform.right * throwFlyVector.x;
|
|
}
|
|
else if (throwNear)
|
|
{
|
|
vector *= throwNearVector.z;
|
|
vector.y += throwNearVector.y;
|
|
vector += base.transform.right * throwNearVector.x;
|
|
}
|
|
else
|
|
{
|
|
vector *= throwVector.z;
|
|
vector.y += throwVector.y;
|
|
vector += base.transform.right * throwVector.x;
|
|
}
|
|
Debug.DrawLine(fishingPlayer.ufpsCamera.transform.position, throwVector, Color.yellow, 5f);
|
|
float num3 = ((!throwNear) ? throwStrength : throwStrengthNear);
|
|
if (VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
num3 = vrThrowStrengthMultiplier;
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.STRENGTH_3).isUnlocked)
|
|
{
|
|
num3 *= 1.3f;
|
|
}
|
|
else if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.STRENGTH_2).isUnlocked)
|
|
{
|
|
num3 *= 1.2f;
|
|
}
|
|
else if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.STRENGTH_1).isUnlocked)
|
|
{
|
|
num3 *= 1.1f;
|
|
}
|
|
}
|
|
}
|
|
else if (fishingHands.isFloatRig)
|
|
{
|
|
num3 *= throwStrengthFloatFactor;
|
|
}
|
|
else if (fishingHands.isFlyRig)
|
|
{
|
|
num3 *= throwStrengthFlyFactor;
|
|
float num4 = Mathf.InverseLerp(0f, flyCastDuration, flyCastTimer);
|
|
if (num4 > 0.5f)
|
|
{
|
|
num4 = 1f - num4;
|
|
}
|
|
num4 *= 2f;
|
|
Debug.Log("FLyCast precision: " + num4);
|
|
num3 *= Mathf.Lerp(0.5f, 1f, num4);
|
|
vector += base.transform.right * 0.65f * (1f - num4) * ((!(UnityEngine.Random.value > 0.5f)) ? (-1f) : 1f);
|
|
}
|
|
Utilities.SetLayerRecursively(fishingHands.throwFakeObject.gameObject, "TransparentFX");
|
|
fishingHands.throwFakeObject.transform.parent = null;
|
|
fishingHands.throwFakeObject.transform.position = fishingHands.fishingRod.rodEndPosition.position;
|
|
fishingHands.throwFakeObject.velocity = Vector3.zero;
|
|
fishingHands.throwFakeObject.angularVelocity = Vector3.zero;
|
|
fishingHands.throwFakeObject.isKinematic = false;
|
|
fishingHands.throwFakeObject.gameObject.SetActive(true);
|
|
Debug.Log("throwFakeObject cast position: " + fishingHands.throwFakeObject.transform.position.ToString());
|
|
Vector3 force = vector * num3;
|
|
Debug.Log("Cast strength: " + force.magnitude);
|
|
if (VRManager.Instance.IsVRHoldRod())
|
|
{
|
|
float num5 = ((VRManager.GetControllerType(true) != OVRInput.OpenVRController.WindowsMRController) ? 10000f : 16000f);
|
|
if ((bool)GlobalSettings.Instance)
|
|
{
|
|
if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.STRENGTH_3).isUnlocked)
|
|
{
|
|
num5 *= 1.3f;
|
|
}
|
|
else if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.STRENGTH_2).isUnlocked)
|
|
{
|
|
num5 *= 1.2f;
|
|
}
|
|
else if ((bool)GlobalSettings.Instance.skillsManager.GetSkill(SkillsManager.SkillType.STRENGTH_1).isUnlocked)
|
|
{
|
|
num5 *= 1.1f;
|
|
}
|
|
}
|
|
num5 = force.magnitude / num5;
|
|
if (num5 > 1f)
|
|
{
|
|
force /= num5;
|
|
Debug.LogError("Max cast force: " + num5 + " " + force.magnitude);
|
|
}
|
|
}
|
|
fishingHands.throwFakeObject.AddForce(force);
|
|
Debug.DrawLine(fishingHands.throwFakeObject.transform.position, fishingHands.throwFakeObject.transform.position + vector, Color.magenta, 5f);
|
|
LeanTween.delayedCall(1f, (Action)delegate
|
|
{
|
|
Utilities.SetLayerRecursively(fishingHands.throwFakeObject.gameObject, "Bait");
|
|
});
|
|
if ((bool)fishingHands.fishingFloat)
|
|
{
|
|
fishingHands.floatRope.regenerateRope(false);
|
|
}
|
|
fishingHands.fishingRod.ShowReelLine(true);
|
|
}
|
|
else
|
|
{
|
|
fishingHands.throwObject.GetComponent<Rigidbody>().isKinematic = false;
|
|
}
|
|
if ((bool)fishingHands.fishingFloat)
|
|
{
|
|
Utilities.SetLayerRecursively(fishingHands.fishingFloat.gameObject, "Float");
|
|
}
|
|
if ((bool)fishingHands.feeder)
|
|
{
|
|
Utilities.SetLayerRecursively(fishingHands.feeder.gameObject, "Default");
|
|
}
|
|
fishingHands.bait.UpdateLayers("Bait", true);
|
|
if ((bool)fishingHands.biteIndicator)
|
|
{
|
|
fishingHands.biteIndicator.StartFishing();
|
|
}
|
|
fishingHands.baitWasThrown = true;
|
|
if ((bool)fishingPlayer.fishingPlayerRemote)
|
|
{
|
|
fishingPlayer.fishingPlayerRemote.StateChanged();
|
|
}
|
|
fishingHands.fishingRod.UpdateBaitDistance();
|
|
fishingPlayer.gameController.ShowFishEscapeColliders(false);
|
|
fishingPlayer.gameController.hudManager.UpdateControls();
|
|
}
|
|
|
|
public void ThrowBaitFlyCasting()
|
|
{
|
|
}
|
|
|
|
public void MakeFirstJerk()
|
|
{
|
|
Debug.Log("MakeFirstJerk");
|
|
FishingHands fishingHands = fishingPlayer.fish.storedBait.fishingHands;
|
|
fishingHands.currentRope.regenerateRope(true);
|
|
if ((bool)fishingHands.fishingFloat)
|
|
{
|
|
fishingHands.fishingLine.FixFloatDistance();
|
|
}
|
|
fishingHands.fishingRod.ChangeBendWarpPosition(true);
|
|
if (fishingHands.isFloatRig || fishingHands.isGroundRig)
|
|
{
|
|
fishingHands.bait.SetFish(fishingPlayer.fish);
|
|
}
|
|
if (fishingHands.isFlyRig)
|
|
{
|
|
fishingHands.CreateArmJoint();
|
|
}
|
|
if (fishingHands == this.fishingHands && (bool)this.fishingHands.biteIndicator && !this.fishingHands.fishingRod.isOnRodStand)
|
|
{
|
|
this.fishingHands.biteIndicator.StopIndicating();
|
|
}
|
|
fishingPlayer.fish.FirstJerk();
|
|
fishingPlayer.fish.AttachToBoat(null);
|
|
}
|
|
|
|
public void UpdateThrowStrength()
|
|
{
|
|
float num = throwStrengthMax + 100f * fishingPlayer.GetCurrentStrength();
|
|
num *= throwStrengthFactor;
|
|
throwStrength += throwStrengthSpeed * Time.deltaTime * ((!throwStrengthDir) ? (-1f) : 1f) * throwStrengthFactor;
|
|
if (throwStrength > num)
|
|
{
|
|
throwStrength = num;
|
|
throwStrengthDir = false;
|
|
}
|
|
else if (throwStrength < throwStrengthMin)
|
|
{
|
|
throwStrength = throwStrengthMin;
|
|
throwStrengthDir = true;
|
|
}
|
|
currentThrowStrength01 = (throwStrength - throwStrengthMin) / (num - throwStrengthMin);
|
|
fishingPlayer.gameController.hudManager.hudFishing.UpdateThrowStrength(currentThrowStrength01 * 100f);
|
|
}
|
|
|
|
public void InitFlyCasting()
|
|
{
|
|
flyCastTimer = 0f;
|
|
isCastingFly = true;
|
|
fishingPlayer.gameController.hudManager.hudFishing.UpdateFlyCast(0f);
|
|
fishingPlayer.gameController.hudManager.hudFishing.ShowFlyCastSlider(true);
|
|
Debug.Log("InitFlyCasting");
|
|
}
|
|
|
|
private void FishCanBePulled()
|
|
{
|
|
if ((!fishingPlayer.fish && !fishingPlayer.junk) || fishingPlayer.fish.isWatchingFish)
|
|
{
|
|
return;
|
|
}
|
|
Transform transform = ((!(fishingPlayer.fish != null)) ? fishingPlayer.junk.transform : fishingPlayer.fish.transform);
|
|
Vector3 vector = fishingHands.fishingRod.ropeStartPosition.position - transform.position;
|
|
vector.y = 0f;
|
|
float magnitude = vector.magnitude;
|
|
Vector3 vector2 = fishingPlayer.transform.position - transform.position;
|
|
vector2.y = 0f;
|
|
float magnitude2 = vector2.magnitude;
|
|
bool flag = false;
|
|
if (magnitude < ((fishingPlayer.fish.watchStyle != Fish.WatchStyle.HANDS) ? catchAreaRadius : netAreaRadius) || fishingPlayer.fish.isInNetArea)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (fishingHands.bait.transform.position.y < -2.5f)
|
|
{
|
|
flag = false;
|
|
}
|
|
if ((bool)fishingPlayer.fish && fishingPlayer.PlayerFishStrengthDiff <= 0.1f)
|
|
{
|
|
flag = false;
|
|
}
|
|
fishCanBePulled = flag;
|
|
fishCanBePulledNet = false;
|
|
if (!fishingPlayer.fish.isInNetArea && fishingPlayer.fish.watchStyle == Fish.WatchStyle.HANDS)
|
|
{
|
|
fishingPlayer.fish.isInNetArea = flag && fishingHands.fishingLine.looseLength < 0.05f;
|
|
}
|
|
if (fishingPlayer.fish.isInNetArea)
|
|
{
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.FISHING_NET_START);
|
|
fishInNetAreaTimer += Time.deltaTime;
|
|
if (fishInNetAreaTimer > 5f)
|
|
{
|
|
Debug.LogError("Fish Net Pull hack");
|
|
fishingPlayer.FishCatch(fishingPlayer.fish);
|
|
}
|
|
}
|
|
if (!fishingPlayer.fish || fishingPlayer.fish.watchStyle != Fish.WatchStyle.HANDS)
|
|
{
|
|
return;
|
|
}
|
|
fishCanBePulledNet = true;
|
|
float num = Vector3.Distance(fishingHands.fishingNetMountPosition.position, fishingPlayer.fish.transform.position);
|
|
if (num > 5.5f)
|
|
{
|
|
fishCanBePulledNet = false;
|
|
}
|
|
else if (magnitude > ((!fishingPlayer.fish.isInNetArea) ? 0.7f : 1.5f) && magnitude2 > magnitude && !VRManager.IsVROn())
|
|
{
|
|
fishCanBePulledNet = false;
|
|
}
|
|
if (fishCanBePulledNet)
|
|
{
|
|
Vector3 vector3 = fishingPlayer.ufpsCamera.transform.position + base.transform.forward * 0.5f;
|
|
RaycastHit hitInfo;
|
|
if (Physics.Raycast(vector3, fishingPlayer.fish.transform.position - vector3, out hitInfo, num, LayerMask.GetMask("Terrain", "Default", "Boat", "MovableObject")))
|
|
{
|
|
fishCanBePulledNet = false;
|
|
}
|
|
}
|
|
if (fishCanBePulledNet)
|
|
{
|
|
StartCoroutine(fishingPlayer.underwaterCamera.TurnOn(false));
|
|
}
|
|
}
|
|
|
|
private bool FishCanBePulledIce()
|
|
{
|
|
if ((fishingPlayer.drillingController.currentHole.holeCenter.position - fishingPlayer.fish.transform.position).magnitude < catchAreaRadius)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void CheckObjectSize()
|
|
{
|
|
bool flag = true;
|
|
if ((bool)fishingPlayer.junk)
|
|
{
|
|
flag = fishingPlayer.junk.junkSize == Junk.JunkSize.SMALL;
|
|
}
|
|
else if ((bool)fishingPlayer.fish)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (!flag)
|
|
{
|
|
fishingPlayer.gameController.hudManager.ShowMessage(Utilities.GetTranslation("HUD_MESSAGE/HOLE_TOO_SMALL"));
|
|
fishingPlayer.ResetJunk();
|
|
}
|
|
}
|
|
|
|
public void CheckFishingDirection()
|
|
{
|
|
}
|
|
|
|
public void FinishFishing()
|
|
{
|
|
fishingHands.StopFishing(true);
|
|
fishingPlayer.ResetFishing();
|
|
GameController.Instance.waterEffectsManager.SplashWakeLoopeEffect(false, Vector3.zero, 7f);
|
|
if (TutorialManager.Instance.WasTutorialShown(TutorialManager.TutorialsId.REEL_01))
|
|
{
|
|
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.THROW_FAR_01, 1f);
|
|
}
|
|
HUDManager.Instance.HideEndlessMessage();
|
|
}
|
|
|
|
public void FinishIceFishing()
|
|
{
|
|
fishingPlayer.ChangeState(FishingPlayer.PlayerState.NORMAL);
|
|
fishingHands.StopIceFishing();
|
|
fishingHands.bait.transform.parent = fishingHands.fishingRod.baitThrowPosition;
|
|
fishingHands.throwObject.transform.localPosition = Vector3.zero;
|
|
fishingHands.throwObject.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
|
|
if ((bool)fishingPlayer.fishingPlayerRemote)
|
|
{
|
|
fishingPlayer.fishingPlayerRemote.StateChanged();
|
|
}
|
|
if (VRManager.IsVROn())
|
|
{
|
|
fishingPlayer.ChangeVRCameraHeight(VRManager.Instance.cameraHeight);
|
|
}
|
|
}
|
|
|
|
public bool CanLowerIceLine()
|
|
{
|
|
if (fishingHands.bait.isOnWater)
|
|
{
|
|
return fishingHands.fishingRod.GetBaitDistance() < fishingHands.reel.maxLineLength;
|
|
}
|
|
Debug.DrawRay(fishingHands.fishingRod.rodEndPosition.position, -base.transform.up * 0.7f, Color.yellow);
|
|
RaycastHit hitInfo;
|
|
if (Physics.Raycast(fishingHands.fishingRod.rodEndPosition.position, -base.transform.up, out hitInfo, 0.7f, LayerMask.GetMask("Terrain", "Default")))
|
|
{
|
|
return fishingHands.currentRope.totalLength < 0.25f;
|
|
}
|
|
return true;
|
|
}
|
|
}
|