Files
2026-02-21 16:45:37 +08:00

2925 lines
79 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using BitStrap;
using Moonlit.IceFishing;
using PhysicsTools;
using UltimateWater;
using UnityEngine;
public class FishingHands : MonoBehaviour
{
[HideInInspector]
public Animator animator;
[ReadOnly]
public FishingPlayer fishingPlayer;
[ReadOnly]
public Transform startParent;
[HideInInspector]
public EquipmentManager equipmentManager;
[HideInInspector]
public bool firstUpdate = true;
[ReadOnly]
public int equipmentSetId;
public float equipmentDurability = 0.5f;
[ReadOnly]
public bool baitWasThrown;
[Header("Ropes")]
public Rigidbody throwFakeObject;
[ReadOnly]
public GameObject throwObject;
[ReadOnly]
public bool isThrowing;
[ReadOnly]
public bool isThrowingNear;
public Light flashLight;
[Header("Prefabs")]
[ReadOnly]
public bool hasRequiredEquipments = true;
[Space(10f)]
[ReadOnly]
public FishingRod fishingRod;
public FishingRod fishingRodPrefab;
public FishingRod fishingIceRodPrefab;
public Transform fishingRodMountPosition;
public Vector2 throwAnimSpeed = new Vector2(0.4f, 1.2f);
[HideInInspector]
public FishingRodController FRC;
public Vector2 baitStartPosition = Vector2.zero;
public Vector2 baitNormalStartPosition = new Vector2(1.95f, 1.8f);
public Vector2 baitIceStartPosition = new Vector2(0.2f, 0.2f);
public float rodBendDelay = 20f;
[ReadOnly]
[Space(10f)]
public FishingReel reel;
public FishingReel reelPrefab;
public Vector2 reelSpeed = new Vector2(1f, 2.5f);
public Vector2 reelIceSpeed = new Vector2(0.2f, 1f);
[ReadOnly]
public float currentUserReelSpeed = 0.5f;
[ReadOnly]
public float currentReelSpeed = 0.5f;
[ReadOnly]
public float targetReelSpeed = 0.5f;
public float changeReelSpeedFactor = 3f;
public float dragRotateSpeed = 1.5f;
public Transform reelLineParent;
public MeshRenderer reelLine;
public MeshRenderer reelLineIdle;
public Transform flyReelLineParent;
public MeshRenderer flyReelLine;
public Transform fly2ReelLineParent;
public MeshRenderer fly2ReelLine;
[ReadOnly]
[Space(10f)]
public Bait bait;
public Bait baitPrefab;
public WaterInteractive baitWaterRipple;
public Vector3 baitWaterRippleStartScale = Vector3.one;
public List<BaitPart> baitPartsPrefabs = new List<BaitPart>();
[HideInInspector]
public SpinningMethodController spinningMethodController;
[Space(10f)]
[ReadOnly]
public FishingFloat fishingFloat;
public FishingFloat fishingFloatPrefab;
public FishingFloat fishingFloatTestPrefab;
public Vector3 floatRopeDistance = new Vector3(0f, 0.5f, 0f);
public float floatRopeDepth = 30f;
public float maxFloatDistFight = 1.5f;
public float floatSizeMultiplier = 1f;
[Space(10f)]
[ReadOnly]
public FishingLine fishingLine;
public FishingLine fishingLinePrefab;
[HideInInspector]
public FishingLineController FLC;
[Space(10f)]
[ReadOnly]
public List<FloatWeight> floatWeights = new List<FloatWeight>();
public List<FloatWeight> floatWeightsPrefabs = new List<FloatWeight>();
[ReadOnly]
public float totalFloatWeights;
[Space(10f)]
public FishingNet fishingNet;
public FishingNet fishingNetPrefab;
public Transform fishingNetMountPosition;
public GameObject fishingNetArm;
[ReadOnly]
[Space(10f)]
public Auger driller;
public Auger drillerPrefab;
public Auger drillerWalking;
[ReadOnly]
[Space(10f)]
public BiteIndicator biteIndicator;
public BiteIndicator biteIndicatorPrefab;
public BiteIndicator biteIndicatorNonePrefab;
[Space(10f)]
public RodStand rodStandPrefab;
public static RodStand rodStand;
public static RodStand rodStandFromEquipment;
[Space(10f)]
[ReadOnly]
public Feeder feeder;
public Feeder feederPrefab;
public Boilie feederBaitPrefab;
[ReadOnly]
[Space(10f)]
public bool isSpinningRig;
[ReadOnly]
public bool isFloatRig;
[ReadOnly]
public bool isGroundRig;
[ReadOnly]
public bool isFlyRig;
[Space(10f)]
public Explosive explosivePrefab;
[HideInInspector]
public Explosive currentExplosive;
public Boilie boiliePrefab;
[HideInInspector]
public Boilie currentBoilie;
public Attractor attractorPrefab;
[HideInInspector]
public Attractor attractor;
[Header("Hands")]
public GameObject rightArm;
public GameObject leftArm;
public Vector3 rightArmWalkingPos = Vector3.zero;
public Vector3 rightArmFishingPos = Vector3.zero;
public Vector3 rightArmMultiplikatorPos = Vector3.zero;
public Vector3 rightArmFlyFishingPos = Vector3.zero;
public List<SkinnedMeshRenderer> armsMeshRenderers = new List<SkinnedMeshRenderer>();
public Material vrHandsMaterial;
public Transform leftArmReelParent;
public Transform leftArmReelParentOffset;
public Vector3 leftArmReelParentStartPos = Vector3.zero;
public Vector3 leftArmIdleOffset = new Vector3(-0.1f, -0.15f, 0.1f);
public Transform flyArmStartPos;
public Transform flyArmFinishPos;
public Transform flyArmPullPos;
public Transform flyArmThumb;
[ReadOnly]
public bool updateLeftArmPos;
[ReadOnly]
public bool updateLeftArmFly;
public Transform jerkTargetTransform;
public float handsAreMoving;
public Vector2 handsFovPosition = Vector2.zero;
public Vector2 handsFovPositionFishing = Vector2.zero;
public Vector2 handsFovPositionWatch = Vector2.zero;
private LTDescr leanShakeReeling;
[Space(10f)]
public Transform shakeReelingParent;
public Vector3 shakeReelingVector = new Vector3(0f, 5f, 0f);
public Vector2 shakeReelingTime = new Vector2(0.2f, 0.6f);
[Header("Jerk")]
[ReadOnly]
public float currentJerkBlend;
[ReadOnly]
public float targetJerkBlend;
[ReadOnly]
public bool jerkCanBeStopped = true;
public float jerkBlendInc = 0.35f;
public Vector2 jerkBlendSpeed = Vector2.one;
public AnimationCurve jerkBendCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
[ReadOnly]
public float currentJerkSpeed = 1f;
[Space(10f)]
public float pullForceJerk = 100f;
public float pullForceReel = 0.1f;
public float pullForceMove = 1f;
[HideInInspector]
public bool isSmalllJerking;
[ReadOnly]
public float freezeJerkDownTimer;
[ReadOnly]
[Header("Lines")]
public Rope currentRope;
public Rope normalRope;
public Rope iceRope;
public Rope floatRope;
public MeshRenderer fakeStraightLine;
public MeshRenderer fakeIceLine;
public MeshRenderer fakeFloatLine;
public MeshRenderer fakeLeaderLine;
public float fakeStraightLineThreshold = 30f;
public Vector4 ropeReelInSpeed = Vector4.zero;
public MeshRenderer watchFishLine;
public Transform fakeLineIceTarget;
public float lineLeaderLength = 1f;
[ReadOnly]
public Vector2 fakeStraightLineThickness = Vector2.zero;
public Transform swivel;
[Header("Net")]
public float netMoveSpeed = 1f;
public float netRotateSpeed = 1f;
public Vector2 netMoveMaxX = Vector2.one;
public Vector2 netMoveMaxY = Vector2.one;
public Vector2 netMoveMaxZ = Vector2.one;
[Header("Kayak")]
public GameObject kayakHandsParent;
public Transform kayakHandsAnimation;
[HideInInspector]
public Animator kayakHandsAnimator;
public Vector3 kayakHandsSwimPos = Vector3.zero;
[Header("Rod Bend")]
public MegaBendWarp megaBendWarp;
public List<GameObject> bendObjects = new List<GameObject>();
public Vector2 startBend = new Vector2(-90f, 0f);
public Vector2 maxBend = new Vector2(30f, 50f);
public Vector2 bendFactor = new Vector2(1f, 0.5f);
[Header("Hands Rotation")]
public bool useHandsRotation = true;
public float handsRotationFactor = 1f;
public float targetHandsLerp;
[ReadOnly]
public float currentHandsLerp;
public float maxHandsRotation = 45f;
public float handsLerpSpeed = 1f;
public Vector3 handsMaxLeftPos = Vector3.zero;
public Vector3 handsMaxLeftRot = Vector3.zero;
public Vector3 handsMaxRightPos = Vector3.zero;
public Vector3 handsMaxRightRot = Vector3.zero;
public AnimationCurve handLerpCurve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
[Header("Mount Positions")]
public Transform watchFishPosition;
public Transform watchJunkPosition;
public Transform watchHandsPosition;
public Transform watchBigHandsPosition;
public float watchFishFlySpeed = 1f;
public float watchFishJunkSpeed = 1f;
public Transform explosiveParent;
public Transform boilieParent;
public Transform drinkParent;
public Transform foodParent;
public Transform filletParent;
public Transform attractorParent;
public Transform knifeParent;
public GasStove gasStove;
[Header("Rods test")]
public List<GameObject> rodsList = new List<GameObject>();
[ReadOnly]
public int currentRod;
[Header("Shirt test")]
public List<Material> shirtMaterials = new List<Material>();
public List<SkinnedMeshRenderer> shirtObjects = new List<SkinnedMeshRenderer>();
[ReadOnly]
public int currentShirtMaterial;
[HideInInspector]
public AudioObject audioDrinking;
[HideInInspector]
public AudioObject audioEating;
[HideInInspector]
public new Transform transform;
private Vector3 vrReelScale = Vector3.one;
[ReadOnly]
public Vector3 vrRopeCatchPosition = Vector3.zero;
[ReadOnly]
public float vrRopeMaxDistanceFromStart;
[ReadOnly]
public bool vrRopeIsReelingIn;
[ReadOnly]
public float vrRopePullDelay;
[Header("Test Equipment")]
public FishingRod testSpinningRod;
public FishingReel testSpinningReel;
public FishingLine testSpinningLine;
public Bait testSpinningBait;
[Space(10f)]
public FishingRod testFlyRod;
public FishingReel testFlyReel;
public FishingLine testFlyLine;
public Bait testFlyBait;
[Space(10f)]
public FishingFloat testFloat;
public Bait testHook;
public Feeder testFeeder;
public RodStand testRodStand;
[Space(10f)]
public FishingRod testMarlinRod;
public FishingReel testMarlinReel;
public FishingLine testMarlinLine;
public Bait testMarlinBait;
[Space(10f)]
public FishingRod testMarlinBigRod;
public FishingReel testMarlinBigReel;
public FishingLine testMarlinBigLine;
private void Awake()
{
if (!GameController.Instance)
{
return;
}
transform = GetComponent<Transform>();
if ((bool)GlobalSettings.Instance)
{
equipmentManager = GlobalSettings.Instance.equipmentManager;
}
animator = GetComponent<Animator>();
kayakHandsAnimator = kayakHandsAnimation.GetComponent<Animator>();
spinningMethodController = GetComponent<SpinningMethodController>();
FLC = GetComponent<FishingLineController>();
if (GameController.Instance.iceLevel)
{
ChangeShirtMaterial(1);
}
else
{
ChangeShirtMaterial(0);
}
currentRope = ((!GameController.Instance.iceLevel) ? normalRope : iceRope);
ChangeRod();
ChangeReel();
ChangeLine();
ChangeFloat();
ChangeBoilie();
ChangeBiteIndicator();
ChangeRodStand();
ChangeFeeder();
UpdateRigType();
fishingNet.fishingHands = this;
fishingNet.Initialize();
fishingNet.HideNet(true);
if (GameController.Instance.iceLevel)
{
driller = UnityEngine.Object.Instantiate(drillerPrefab);
driller.gameObject.SetActive(false);
ShowWalkingDriller(true);
}
else
{
ShowWalkingDriller(false);
}
kayakHandsParent.SetActive(false);
if ((bool)attractorPrefab)
{
attractor = UnityEngine.Object.Instantiate(attractorPrefab);
attractor.transform.parent = attractorParent;
attractor.transform.localRotation = Quaternion.identity;
attractor.transform.localPosition = -attractor.grabPosition.localPosition;
attractor.InitShake();
}
if ((bool)megaBendWarp)
{
foreach (GameObject bendObject in bendObjects)
{
if (bendObject.activeSelf)
{
MegaWarpBind megaWarpBind = bendObject.AddComponent<MegaWarpBind>();
megaWarpBind.SetTarget(megaBendWarp.gameObject);
megaWarpBind.DisplayGizmo = false;
}
}
}
CalculateEquipmentDurability();
currentRope.regenerateRope(true);
leanShakeReeling = LeanTween.rotateLocal(shakeReelingParent.gameObject, shakeReelingParent.localEulerAngles + shakeReelingVector, shakeReelingTime.y).setLoopPingPong().setEase(LeanTweenType.easeShake)
.setRepeat(-1)
.pause();
flashLight.enabled = true;
throwFakeObject.gameObject.SetActive(false);
fakeLineIceTarget.parent = GameController.Instance.transform;
}
private void Start()
{
if (!GameController.Instance)
{
return;
}
if (transform.parent == null)
{
Debug.LogError("transform.parent == null)");
base.gameObject.SetActive(false);
return;
}
HideLeftArm();
baitWaterRipple.transform.parent = throwObject.transform;
baitWaterRipple.transform.localPosition = Vector3.zero;
baitWaterRipple.GetComponent<MeshRenderer>().material = GameController.Instance.waterInteractiveMaterial;
if ((bool)GlobalSettings.Instance)
{
floatSizeMultiplier = 1f + GlobalSettings.Instance.playerSettings.floatSizeMultiplier * 0.25f;
rodBendDelay = GlobalSettings.Instance.renderSettings.GetQualityDefinition().rodBendDelay;
}
if (fishingPlayer == null && (bool)GameController.Instance.fishingPlayer)
{
SetFishingPlayer();
}
HUDManager.Instance.hudBaits.Refresh(this);
LeanTween.delayedCall(1f, (Action)delegate
{
HUDManager.Instance.hudBaits.Refresh(this);
});
MegaModifiers.ThreadingOn = true;
if (VRManager.IsVROn())
{
ToggleVRArmRenderers();
}
}
private void OnEnable()
{
LeanTween.delayedCall(0.01f, (Action)delegate
{
if ((bool)startParent)
{
transform.parent = startParent;
transform.localPosition = Vector3.zero;
transform.localEulerAngles = Vector3.zero;
}
}).setIgnoreTimeScale(true);
}
private void OnDisable()
{
LeanTween.delayedCall(0.01f, (Action)delegate
{
if (this != null && (bool)transform)
{
transform.parent = null;
transform.localPosition = -Vector3.up * 666f;
}
}).setIgnoreTimeScale(true);
}
private void OnDestroy()
{
if ((bool)fishingLine)
{
fishingLine.ResetMaterial();
}
}
[Button]
public void ChangeEquipmentButton()
{
base.gameObject.SetActive(true);
StartCoroutine(ChangeEquipment());
}
public IEnumerator ChangeEquipment()
{
Debug.Log("ChangeEquipment");
if (fishingPlayer.currentState == FishingPlayer.PlayerState.ICE_FISHING)
{
fishingPlayer.ResetFishing();
}
if (equipmentManager.equipmentChanged[0] || equipmentManager.equipmentChanged[1])
{
ChangeRod();
}
else
{
if (equipmentManager.equipmentChanged[2])
{
ChangeReel();
}
else if (equipmentManager.equipmentChanged[3])
{
ChangeLine();
}
if (equipmentManager.equipmentChanged[4])
{
ChangeFloat();
}
else if (equipmentManager.equipmentChanged[5])
{
if ((bool)fishingFloat)
{
ChangeFloat();
}
else
{
ChangeBait();
}
}
else if (equipmentManager.equipmentChanged[6])
{
ChangeBaitParts();
}
}
if (equipmentManager.equipmentChanged[8])
{
ChangeBoilie();
}
if (equipmentManager.equipmentChanged[9])
{
ChangeRodStand();
}
if (equipmentManager.equipmentChanged[10] || equipmentManager.equipmentChanged[11])
{
ChangeFeeder();
}
if (equipmentManager.equipmentChanged[12])
{
ChangeBiteIndicator();
}
equipmentManager.ResetChanged();
HUDManager.Instance.UpdateControls();
CheckHasHook();
if (fishingPlayer.currentState == FishingPlayer.PlayerState.ICE_FISHING)
{
ShowRod();
ShowRopes(true);
InitIceEquipment();
}
UpdateRigType();
HideHandsCamera((bool)equipmentManager && !equipmentManager.CheckMinimumRequiredEquipment());
transform.localScale = Vector3.one;
yield return null;
HUDManager.Instance.hudBaits.Refresh(this);
}
[Button]
public void ChangeRod()
{
bool flag = fishingRod == null;
if (!flag)
{
baitWaterRipple.transform.parent = null;
fakeStraightLine.transform.parent.parent = null;
UnityEngine.Object.DestroyImmediate(fishingRod.gameObject);
}
if (GameController.Instance.iceLevel)
{
if ((bool)equipmentManager && equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.ICE_ROD) != null && (bool)equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.ICE_ROD).prefab)
{
fishingRod = UnityEngine.Object.Instantiate(equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.ICE_ROD).prefab.GetComponent<FishingRod>());
}
else
{
fishingRod = UnityEngine.Object.Instantiate(fishingIceRodPrefab);
}
}
else if ((bool)equipmentManager && equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.ROD) != null && (bool)equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.ROD).prefab)
{
fishingRod = UnityEngine.Object.Instantiate(equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.ROD).prefab.GetComponent<FishingRod>());
}
else
{
fishingRod = UnityEngine.Object.Instantiate(fishingRodPrefab);
}
fishingRod.fishingHands = this;
if (VRManager.IsVROn() && fishingRod.rodType != FishingRod.RodType.FLY_FISHING && fishingRod.rodType != FishingRod.RodType.ICE_FISHING)
{
fishingRod.handMountPosition.localPosition = new Vector3(fishingRod.handMountPosition.localPosition.x, fishingRod.reelMountPosition.localPosition.y + 0.025f, fishingRod.handMountPosition.localPosition.x);
}
fishingRod.transform.parent = fishingRodMountPosition;
fishingRod.transform.localPosition = -fishingRod.handMountPosition.localPosition;
fishingRod.transform.localRotation = Quaternion.identity;
if (VRManager.IsVROn())
{
if ((bool)fishingPlayer && fishingRod.rodType != FishingRod.RodType.ICE_FISHING)
{
fishingRod.transform.localScale = Vector3.one * (1f / fishingPlayer.vrHandsParent.localScale.y);
}
else
{
fishingRod.transform.localScale = Vector3.one;
}
}
FRC = GetComponent<FishingRodController>();
FRC.fishingRod = fishingRod;
FRC.Initialize();
Utilities.SetLayerRecursively(fishingRod.gameObject, "Weapon");
currentRope.startPosition = fishingRod.rodMegaAttachPosition;
baitStartPosition = ((!GameController.Instance.iceLevel) ? baitNormalStartPosition : baitIceStartPosition);
if (!flag)
{
ChangeReel();
ChangeFloat();
ChangeBiteIndicator();
SetFishingPlayer();
if (GameController.Instance.iceLevel)
{
fishingPlayer.currentHands.HideRod();
}
}
}
public void ChangeReel()
{
if (!(reel == null))
{
UnityEngine.Object.DestroyImmediate(reel.gameObject);
}
if (GameController.Instance.iceLevel)
{
reel = fishingRod.mountedReel;
}
else
{
if ((bool)equipmentManager && equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.REEL) != null && (bool)equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.REEL).prefab)
{
reel = UnityEngine.Object.Instantiate(equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.REEL).prefab.GetComponent<FishingReel>());
}
else
{
reel = UnityEngine.Object.Instantiate(reelPrefab);
}
vrReelScale = reel.transform.localScale;
reel.transform.parent = fishingRod.reelMountPosition;
reel.transform.localPosition = -reel.mountPosition.localPosition * reel.transform.lossyScale.x;
reel.transform.localRotation = Quaternion.identity;
FixVRReelScale();
}
reel.fishingHands = this;
if (reel.reelType == FishingReel.ReelType.LINE_COUNTER)
{
fishingRod.transform.localEulerAngles = new Vector3(0f, 180f, 0f);
if ((bool)fishingRod.handMultiMountPosition)
{
fishingRod.transform.localPosition = -fishingRod.handMultiMountPosition.localPosition;
}
}
else
{
fishingRod.transform.localEulerAngles = Vector3.zero;
fishingRod.transform.localPosition = -fishingRod.handMountPosition.localPosition;
}
Utilities.SetLayerRecursively(reel.gameObject, "Weapon");
ChangeLine();
}
[Button]
public void FixVRReelScale()
{
if (VRManager.IsVROn())
{
reel.transform.localScale = new Vector3(Mathf.Abs(vrReelScale.x), Mathf.Abs(vrReelScale.y), Mathf.Abs(vrReelScale.z));
}
}
public void ChangeFloat()
{
bool flag = fishingFloat == null;
if (!flag)
{
for (int i = 0; i < floatWeights.Count; i++)
{
UnityEngine.Object.DestroyImmediate(floatWeights[i]);
}
floatWeights.Clear();
baitWaterRipple.transform.parent = null;
baitWaterRipple.transform.localScale = baitWaterRippleStartScale;
UnityEngine.Object.DestroyImmediate(fishingFloat.gameObject);
}
if (!GameController.Instance.iceLevel)
{
if ((bool)equipmentManager)
{
EquipmentObject currentEquipment = equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.FLOAT);
if (currentEquipment != null && (bool)currentEquipment.prefab)
{
fishingFloat = UnityEngine.Object.Instantiate(currentEquipment.prefab.GetComponent<FishingFloat>());
}
}
else if ((bool)fishingFloatPrefab)
{
fishingFloat = UnityEngine.Object.Instantiate(fishingFloatPrefab);
}
if ((bool)fishingFloat)
{
if ((bool)GlobalSettings.Instance)
{
floatRopeDepth = GlobalSettings.Instance.equipmentManager.currentSetSpecificParameters.currentFloatDepth;
floatRopeDepth *= 0.01f;
floatRopeDepth += 0.001f;
Debug.Log("currentFloatDepth: " + GlobalSettings.Instance.equipmentManager.currentSetSpecificParameters.currentFloatDepth + " floatRopeDepth: " + floatRopeDepth);
fishingFloat.currentBurden = GlobalSettings.Instance.equipmentManager.currentSetSpecificParameters.currentFloatWeight;
}
else
{
fishingFloat.currentBurden = fishingFloat.optimalBurden;
}
fishingFloat.fishingHands = this;
fishingFloat.transform.parent = transform;
if (!flag)
{
}
fishingFloat.transform.position = fishingRod.rodEndPosition.position + new Vector3(0f, 0f - baitStartPosition.y * 2f, 0f);
if (!GameController.Instance.iceLevel)
{
fishingFloat.model.localScale = Vector3.one * 2f;
}
}
}
if ((bool)fishingFloat)
{
Utilities.SetLayerRecursively(fishingFloat.gameObject, "Weapon");
}
if (flag || (bool)fishingFloat)
{
}
ChangeBait();
ChangeRopeTargets();
baitWaterRipple.transform.localScale = baitWaterRippleStartScale;
baitWaterRipple.transform.parent = throwObject.transform;
baitWaterRipple.transform.localPosition = Vector3.zero;
currentRope.regenerateRope(true);
CalculateEquipmentDurability();
ChangeFloatWeights();
}
public void UpdateFloatDepth()
{
if ((bool)fishingFloat && (bool)GlobalSettings.Instance)
{
floatRopeDepth = GlobalSettings.Instance.equipmentManager.currentSetSpecificParameters.currentFloatDepth;
floatRopeDepth *= 0.01f;
floatRopeDepth += 0.001f;
}
}
public void ChangeBait()
{
bool flag = bait == null;
if (!flag)
{
baitWaterRipple.transform.parent = null;
baitWaterRipple.transform.localScale = baitWaterRippleStartScale;
if ((bool)feeder)
{
feeder.transform.parent = null;
}
UnityEngine.Object.DestroyImmediate(bait.gameObject);
}
if ((bool)equipmentManager && equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.HOOK) == null)
{
bait = UnityEngine.Object.Instantiate(baitPrefab);
}
else if ((bool)equipmentManager && (bool)equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.HOOK).prefab)
{
bait = UnityEngine.Object.Instantiate(equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.HOOK).prefab.GetComponent<Bait>());
}
else
{
bait = UnityEngine.Object.Instantiate(baitPrefab);
}
bait.fishingHands = this;
bait.transform.parent = ((!fishingFloat) ? transform : fishingFloat.transform);
bait.transform.parent = GameController.Instance.transform;
bait.Initialize();
throwObject = ((!fishingFloat) ? bait.gameObject : fishingFloat.gameObject);
spinningMethodController.bait = bait;
spinningMethodController.fishingFloat = fishingFloat;
spinningMethodController.fishingHands = this;
if (fishingLine.lineType == FishingLine.LineType.FLY && bait.flyType != Bait.FlyType.DRY)
{
if (fishingLine.flyLineType == FishingLine.FlyLineType.FLOATING)
{
bait.targetHeight = -0.2f;
bait.targetSwimHeight = -0.2f;
}
else if (fishingLine.flyLineType == FishingLine.FlyLineType.SINK_TIP)
{
bait.targetHeight = -0.7f;
bait.targetSwimHeight = -0.7f;
}
}
ChangeBaitParts();
bait.UpdateLayers("Weapon", false);
if (!flag)
{
if ((bool)fishingFloat)
{
fishingFloat.Initialize();
fishingFloat.ResetFloat();
}
bait.ResetBait();
ChangeRopeTargets();
baitWaterRipple.transform.localScale = baitWaterRippleStartScale;
baitWaterRipple.transform.parent = throwObject.transform;
baitWaterRipple.transform.localPosition = Vector3.zero;
if ((bool)feeder)
{
feeder.UpdateFeederPosition(false);
}
if ((bool)fishingFloat)
{
floatRope.regenerateRope(true);
}
else
{
currentRope.regenerateRope(true);
}
CalculateEquipmentDurability();
}
if (GameController.Instance.iceLevel)
{
bait.transform.parent = fishingRod.baitThrowPosition;
bait.transform.localPosition = Vector3.zero;
bait.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
bait.rigidbody.isKinematic = true;
currentRope.regenerateRope(true);
}
}
public void ChangeBoilie()
{
if ((bool)equipmentManager)
{
if (equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.BOILIE) == null)
{
boiliePrefab = null;
Debug.Log("equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.BOILIE) == null");
}
else if ((bool)equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.BOILIE).prefab)
{
boiliePrefab = equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.BOILIE).prefab.GetComponent<Boilie>();
}
else
{
boiliePrefab = null;
Debug.Log("equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.BOILIE).prefab == null");
}
}
}
public void ChangeFloatWeights()
{
if ((bool)fishingFloat)
{
if ((bool)equipmentManager)
{
}
for (int i = 0; i < floatWeights.Count; i++)
{
UnityEngine.Object.DestroyImmediate(floatWeights[i].gameObject);
}
floatWeights.Clear();
int num = ((fishingFloat.currentBurden > 0f) ? Mathf.Min(Mathf.CeilToInt(fishingFloat.currentBurden / 5f), 6) : 0);
for (int j = 0; j < num; j++)
{
FloatWeight floatWeight = null;
floatWeight = UnityEngine.Object.Instantiate(floatWeightsPrefabs[j]);
floatWeight.transform.parent = null;
floatWeights.Add(floatWeight);
}
totalFloatWeights = 0f;
for (int k = 0; k < floatWeights.Count; k++)
{
floatWeights[k].Initialize();
totalFloatWeights += floatWeights[k].weight;
Utilities.SetLayerRecursively(floatWeights[k].gameObject, "Default");
}
UpdateFloatWeightPosition(false);
}
}
public void UpdateFloatWeightPosition(bool underwater)
{
if (!fishingFloat)
{
return;
}
float num = 0.1f;
float num2 = 0f;
float f = 0.7f;
Vector3 normalized = (fishingFloat.transform.position - bait.transform.position).normalized;
for (int i = 0; i < floatWeights.Count; i++)
{
num2 += num * Mathf.Pow(f, i);
if (underwater)
{
floatWeights[i].transform.parent = fishingPlayer.underwaterCamera.lineUnderwaterFloat.transform.parent;
floatWeights[i].transform.localPosition = new Vector3(0f, 0f, num2);
}
else
{
floatWeights[i].transform.parent = bait.transform;
floatWeights[i].transform.position = bait.transform.position + normalized * num2;
}
}
}
public void ChangeBaitParts()
{
List<BaitPart> list = new List<BaitPart>();
if ((bool)equipmentManager)
{
foreach (EquipmentObject currentEquipmentBait in equipmentManager.GetCurrentEquipmentBaits())
{
if (currentEquipmentBait != null && (bool)currentEquipmentBait.prefab)
{
list.Add(currentEquipmentBait.prefab.GetComponent<BaitPart>());
}
else
{
list.Add(null);
}
}
bait.InitBaitParts(list);
}
else
{
bait.InitBaitParts(baitPartsPrefabs);
}
}
public void ChangeLine()
{
bool flag = fishingLine == null;
if (!flag)
{
UnityEngine.Object.DestroyImmediate(fishingLine.gameObject);
}
if ((bool)equipmentManager && equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.LINE) != null && (bool)equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.LINE).prefab)
{
fishingLine = UnityEngine.Object.Instantiate(equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.LINE).prefab.GetComponent<FishingLine>());
}
else
{
fishingLine = UnityEngine.Object.Instantiate(fishingLinePrefab);
}
fishingLine.gameController = GameController.Instance;
fishingLine.transform.parent = GameController.Instance.transform;
fishingLine.transform.localPosition = Vector3.zero;
fishingLine.transform.localRotation = Quaternion.identity;
fishingLine.fishingRod = fishingRod;
fishingLine.fishingReel = reel;
fishingLine.fishingHands = this;
fishingLine.FLC = FLC;
fishingLine.currentRope = currentRope;
fishingLine.floatRope = floatRope;
fishingLine.lineMaterial = new Material(fishingLine.lineMaterial);
fishingLine.lineMaterialOpaque = new Material(fishingLine.lineMaterialOpaque);
fishingLine.lineMaterial.color = fishingLine.lineColor;
fishingLine.lineMaterial.SetColor("_EmissionColor", fishingLine.emissionColor);
fishingLine.lineMaterialOpaque.color = fishingLine.lineColor;
fishingLine.lineMaterialOpaque.SetColor("_EmissionColor", Color.Lerp(fishingLine.emissionColor, Color.black, 0.45f));
if (GameController.Instance.iceLevel)
{
Material lineMaterialOpaque = fishingLine.lineMaterialOpaque;
Color color = new Color(fishingLine.lineColor.r, fishingLine.lineColor.g, fishingLine.lineColor.b, fishingLine.lineColor.a * 3f);
fishingLine.lineMaterial.color = color;
lineMaterialOpaque.color = color;
}
if (GameController.Instance.thickLine)
{
fishingLine.thiknessDynamic = ((!GameController.Instance.iceLevel) ? 0.4f : 0.2f);
Color color2 = fishingLine.lineMaterial.color;
color2.a = 1f;
fishingLine.lineMaterial.color = color2;
}
currentRope.continuousMaterial = (floatRope.continuousMaterial = fishingLine.lineMaterial);
ChangeRopesRadius(false);
float num = fishingLine.thiknessDynamic * 0.01f;
if (GameController.Instance.iceLevel)
{
num *= 0.45f;
}
Color color3 = fishingLine.lineMaterial.color;
float a = reel.line.GetComponent<MeshRenderer>().material.color.a;
if (!GameController.Instance.iceLevel)
{
color3.a = 1f;
}
else
{
color3.a = a;
}
reel.line.GetComponent<MeshRenderer>().material.color = color3;
if ((bool)fishingRod.lineStatic && reel.reelType != FishingReel.ReelType.LINE_COUNTER)
{
fishingRod.lineStatic.material = fishingLine.lineMaterial;
fishingRod.lineStatic.transform.localScale = new Vector3(num * 100f, fishingRod.lineStatic.transform.localScale.y, num * 100f);
}
else if ((bool)fishingRod.lineStaticTop && reel.reelType == FishingReel.ReelType.LINE_COUNTER)
{
fishingRod.lineStaticTop.material = fishingLine.lineMaterial;
fishingRod.lineStaticTop.transform.localScale = new Vector3(num * 100f, fishingRod.lineStaticTop.transform.localScale.y, num * 100f);
}
if ((bool)fishingRod.lineStatic)
{
fishingRod.lineStatic.gameObject.SetActive(reel.reelType != FishingReel.ReelType.LINE_COUNTER || !fishingRod.lineStaticTop);
}
if ((bool)fishingRod.lineStaticTop)
{
fishingRod.lineStaticTop.gameObject.SetActive(reel.reelType == FishingReel.ReelType.LINE_COUNTER);
}
flyReelLineParent.gameObject.SetActive(true);
fly2ReelLineParent.gameObject.SetActive(true);
if ((bool)reelLineParent && (bool)reel.reelLineFinish)
{
if (reel.reelType == FishingReel.ReelType.STANDARD && (bool)fishingRod.lineStatic)
{
fishingRod.reelLineAttach.transform.position = fishingRod.lineStatic.transform.position;
}
else if (reel.reelType == FishingReel.ReelType.LINE_COUNTER && (bool)fishingRod.lineStaticTop)
{
fishingRod.reelLineAttach.transform.position = fishingRod.lineStaticTop.transform.position;
}
reelLine.material = fishingLine.lineMaterial;
reelLineIdle.material = fishingLine.lineMaterial;
reelLine.transform.localScale = new Vector3(num * 0.7f, Vector3.Distance(fishingRod.reelLineAttach.position, reel.reelLineFinish.position), num * 0.7f);
if (fishingLine.lineType != FishingLine.LineType.FLY)
{
reelLineIdle.transform.localScale = new Vector3(num * 0.2f, reelLine.transform.localScale.y, num * 0.2f);
}
else
{
reelLineIdle.transform.localScale = new Vector3(num * 0.4f, reelLine.transform.localScale.y, num * 0.4f);
}
if ((bool)reel.shortLine)
{
reel.shortLine.material = fishingLine.lineMaterial;
reel.shortLine.transform.localScale = new Vector3(reelLineIdle.transform.localScale.x * 1.6f, reel.shortLine.transform.localScale.y, reelLineIdle.transform.localScale.z * 1.6f);
}
flyReelLine.material = fishingLine.lineMaterial;
fly2ReelLine.material = fishingLine.lineMaterial;
flyReelLine.transform.localScale = reelLine.transform.localScale;
fly2ReelLine.transform.localScale = new Vector3(flyReelLine.transform.localScale.x, 1.5f, flyReelLine.transform.localScale.z);
reelLineParent.position = reel.reelLineFinish.position;
}
flyReelLineParent.gameObject.SetActive(false);
fly2ReelLineParent.gameObject.SetActive(false);
swivel.gameObject.SetActive(fishingLine.lineType == FishingLine.LineType.FLY);
fakeLeaderLine.gameObject.SetActive(fishingLine.lineType == FishingLine.LineType.FLY && !GameController.Instance.iceLevel);
float num2 = ((!GameController.Instance.iceLevel) ? 0.55f : 0.25f);
fakeStraightLine.material = fishingLine.lineMaterial;
fakeStraightLine.transform.localScale = new Vector3(fishingLine.thiknessDynamic * currentRope.segPropertiesCylinder.radius * num2, 1f, fishingLine.thiknessDynamic * currentRope.segPropertiesCylinder.radius * num2);
fakeStraightLine.transform.parent.parent = fishingRod.rodMegaAttachPosition.transform;
fakeStraightLine.transform.parent.localPosition = Vector3.zero;
fakeStraightLine.enabled = false;
fakeIceLine.material = fishingLine.lineMaterialOpaque;
fakeIceLine.transform.localScale = fakeStraightLine.transform.localScale * 0.45f;
fakeIceLine.transform.parent.parent = fakeLineIceTarget.transform;
fakeIceLine.transform.parent.localPosition = Vector3.zero;
fakeIceLine.enabled = false;
watchFishLine.material = fishingLine.lineMaterial;
watchFishLine.transform.parent.position = fishingRod.ropeStartPosition.transform.position;
watchFishLine.transform.localScale = Vector3.one * num * ((!GameController.Instance.iceLevel) ? 0.4f : 0.6f);
watchFishLine.gameObject.SetActive(false);
fakeFloatLine.material = fishingLine.lineMaterial;
fakeFloatLine.transform.localScale = watchFishLine.transform.localScale;
fakeFloatLine.enabled = false;
fakeStraightLineThickness.x = watchFishLine.transform.localScale.x;
fakeStraightLineThickness.y = fakeStraightLine.transform.localScale.x;
Utilities.SetLayerRecursively(fishingLine.gameObject, "Weapon");
Utilities.SetLayerRecursively(fakeIceLine.gameObject, "Default");
if (!flag)
{
CalculateEquipmentDurability();
}
if ((bool)normalRope)
{
normalRope.ropeGameplayType = Rope.RopeGameplayType.NORMAL;
}
if ((bool)floatRope)
{
floatRope.ropeGameplayType = Rope.RopeGameplayType.FLOAT;
}
if ((bool)iceRope)
{
iceRope.ropeGameplayType = Rope.RopeGameplayType.ICE;
}
if (fishingLine.lineType == FishingLine.LineType.FLY)
{
ChangeBait();
}
}
public void ChangeRopeTargets()
{
if ((bool)fishingFloat)
{
fishingFloat.Initialize();
currentRope.controlPoints[0].obj = fishingRod.ropeStartPosition.gameObject;
currentRope.controlPoints[1].obj = fishingFloat.gameObject;
floatRope.controlPoints[0].obj = fishingFloat.gameObject;
floatRope.controlPoints[1].obj = bait.gameObject;
floatRope.startPosition = floatRope.controlPoints[0].obj.transform;
if (floatRopeDepth < 0.6f)
{
floatRope.segPropertiesCylinder.length = 0.2f;
}
else
{
floatRope.segPropertiesCylinder.length = 0.4f;
}
floatRope.gameObject.SetActive(true);
}
else
{
currentRope.controlPoints[0].obj = fishingRod.ropeStartPosition.gameObject;
currentRope.controlPoints[1].obj = bait.gameObject;
floatRope.gameObject.SetActive(false);
}
}
public void ChangeRopesRadius(bool isFishing)
{
float num = ((!isFishing) ? 0.13f : 0.55f);
if (GameController.Instance.iceLevel)
{
num = 0.26f;
}
currentRope.radiusFactor = (floatRope.radiusFactor = fishingLine.thiknessDynamic * num);
}
public void ChangeBiteIndicator()
{
if (!GameController.Instance.iceLevel)
{
if ((bool)biteIndicator)
{
UnityEngine.Object.DestroyImmediate(biteIndicator.gameObject);
}
if ((bool)equipmentManager && equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.BITE_INDICATOR) != null && (bool)equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.BITE_INDICATOR).prefab)
{
biteIndicator = UnityEngine.Object.Instantiate(equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.BITE_INDICATOR).prefab.GetComponent<BiteIndicator>());
}
else if (!equipmentManager && (bool)biteIndicatorPrefab)
{
biteIndicator = UnityEngine.Object.Instantiate(biteIndicatorPrefab);
}
else
{
biteIndicator = UnityEngine.Object.Instantiate(biteIndicatorNonePrefab);
}
if ((bool)biteIndicator)
{
biteIndicator.fishingRod = fishingRod;
biteIndicator.Initialize();
Utilities.SetLayerRecursively(biteIndicator.gameObject, "Weapon");
}
}
}
public void ChangeRodStand()
{
if (GameController.Instance.iceLevel)
{
return;
}
if ((bool)rodStand && (!fishingPlayer || !fishingPlayer.boatSimulator))
{
rodStand.TakeStand();
UnityEngine.Object.DestroyImmediate(rodStand.gameObject);
}
if ((bool)equipmentManager && equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.ROD_STAND) != null && (bool)equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.ROD_STAND).prefab)
{
rodStandFromEquipment = UnityEngine.Object.Instantiate(equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.ROD_STAND).prefab.GetComponent<RodStand>());
}
else if (!equipmentManager && (bool)rodStandPrefab)
{
rodStandFromEquipment = UnityEngine.Object.Instantiate(rodStandPrefab);
}
if (!fishingPlayer || !fishingPlayer.boatSimulator)
{
rodStand = rodStandFromEquipment;
if ((bool)rodStand)
{
rodStand.Initialize();
}
}
}
public void ChangeFeeder()
{
if (GameController.Instance.iceLevel)
{
return;
}
if ((bool)feeder)
{
UnityEngine.Object.DestroyImmediate(feeder.gameObject);
}
if ((bool)equipmentManager && equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.FEEDER) != null && (bool)equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.FEEDER).prefab)
{
feeder = UnityEngine.Object.Instantiate(equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.FEEDER).prefab.GetComponent<Feeder>());
}
else if (!equipmentManager && (bool)feederPrefab)
{
feeder = UnityEngine.Object.Instantiate(feederPrefab);
}
if ((bool)feeder)
{
if ((bool)equipmentManager)
{
feeder.feederBaitEquipmentObject = equipmentManager.GetCurrentEquipment(EquipmentObject.EquipmentType.FEEDER_BAIT);
}
else if (feederBaitPrefab != null)
{
feeder.feederBait = feederBaitPrefab;
}
feeder.fishingHands = this;
feeder.Initialize();
}
}
private void UpdateRigType()
{
isFloatRig = fishingFloat;
isGroundRig = feeder;
isFlyRig = (bool)reel && reel.reelType == FishingReel.ReelType.FLY;
isSpinningRig = !isFloatRig && !isGroundRig && !isFlyRig;
}
public void ParentAllObjects()
{
if ((bool)bait)
{
bait.transform.parent = transform;
bait.transform.localPosition = Vector3.zero;
}
if ((bool)fishingFloat)
{
fishingFloat.transform.parent = transform;
fishingFloat.transform.localPosition = Vector3.zero;
}
fishingLine.transform.parent = transform;
fakeLineIceTarget.transform.parent = transform;
normalRope.transform.parent = transform;
floatRope.transform.parent = transform;
normalRope.regenerateRope(true);
floatRope.regenerateRope(true);
}
public void PrepareNewHands()
{
fishingRod.ResetBend();
flashLight.enabled = false;
}
public void PrepareOldHands()
{
}
public void SetFishingPlayer()
{
fishingPlayer = GameController.Instance.fishingPlayer;
if (!fishingPlayer.allFishingHands.Contains(this))
{
fishingPlayer.allFishingHands.Add(this);
fishingPlayer.allFishingHands.Sort((FishingHands p1, FishingHands p2) => p1.transform.parent.parent.name.CompareTo(p2.transform.parent.parent.name));
startParent = transform.parent;
ParentAllObjects();
base.gameObject.SetActive(false);
if (fishingPlayer.allFishingHands.Count == 5)
{
if ((bool)GlobalSettings.Instance)
{
fishingPlayer.ChangeHands(GlobalSettings.Instance.equipmentManager.currentEquipmentSetId);
}
else
{
fishingPlayer.ChangeHands(0);
}
}
if (VRManager.IsVROn() && (bool)transform.parent)
{
transform.parent.parent.parent = fishingPlayer.vrHandsParent;
}
if (VRManager.IsVROn() && (bool)transform.parent)
{
vp_FPWeapon componentInParent = GetComponentInParent<vp_FPWeapon>();
if (componentInParent != null)
{
componentInParent.PositionPivotSpringDamping = 1f;
componentInParent.PositionSpringDamping = 1f;
componentInParent.PositionSpring2Damping = 1f;
componentInParent.RotationPivotSpringDamping = 1f;
componentInParent.RotationSpringDamping = 1f;
componentInParent.RotationSpring2Damping = 1f;
componentInParent.ShakeSpeed = 0f;
componentInParent.ShakeAmplitude = Vector3.zero;
componentInParent.BobRate = Vector4.zero;
componentInParent.BobAmplitude = Vector4.zero;
componentInParent.StepPositionForce = Vector3.zero;
componentInParent.StepRotationForce = Vector3.zero;
componentInParent.StepForceScale = 0f;
componentInParent.Refresh();
}
else
{
Debug.LogError("vp_FPWeapon == null");
}
flashLight.transform.parent = fishingPlayer.ufpsCamera.transform;
flashLight.enabled = false;
}
}
else
{
if ((bool)equipmentManager)
{
equipmentSetId = equipmentManager.currentEquipmentSetId;
}
fishingPlayer.currentHands = this;
fishingPlayer.fishingController.fishingHands = this;
CheckHasHook();
HideHandsCamera((bool)equipmentManager && !equipmentManager.CheckMinimumRequiredEquipment());
fishingRod.fishingPlayer = fishingPlayer;
fishingPlayer.drillingController.Auger = driller;
if ((bool)attractor)
{
attractor.fishingPlayer = fishingPlayer;
}
}
}
public void Update()
{
if (!GameController.Instance || Time.timeScale == 0f)
{
return;
}
if (firstUpdate)
{
firstUpdate = false;
iceRope.gameObject.SetActive(GameController.Instance.iceLevel);
normalRope.gameObject.SetActive(!GameController.Instance.iceLevel);
if (GameController.Instance.iceLevel)
{
currentRope.regenerateRope(false);
HideRod();
}
}
if (!fishingRod.rodMegaAttach)
{
fishingRod.InitBend();
}
if ((!BugReporter.Instance || !BugReporter.Instance.isVisible) && !GameController.Instance.IsQuickMenu())
{
if (!HUDManager.Instance.hudMultiplayer.isInInputMode && (bool)fishingPlayer && (fishingPlayer.currentState == FishingPlayer.PlayerState.FISHING || fishingPlayer.currentState == FishingPlayer.PlayerState.ICE_FISHING) && baitWasThrown && !fishingRod.isOnRodStand)
{
UpdateReelArm();
reel.UpdateInput();
}
if ((bool)fishingPlayer)
{
UpdateCurrentReelSpeed();
UpdateWaterRipples();
UpdateJerkBlend();
}
}
}
private void LateUpdate()
{
if (!GameController.Instance)
{
return;
}
if (VRManager.IsVROn() && isFlyRig && fly2ReelLineParent.gameObject.activeSelf)
{
fly2ReelLineParent.transform.position = reelLineParent.position;
fly2ReelLineParent.transform.LookAt(reel.reelLineFinish);
fly2ReelLine.transform.localScale = new Vector3(fly2ReelLine.transform.localScale.x, Vector3.Distance(fly2ReelLine.transform.position, reel.reelLineFinish.position) / fishingPlayer.vrHandsParent.localScale.y, fly2ReelLine.transform.localScale.z);
}
StartCoroutine(fishingRod.InitAttach());
if ((bool)fishingPlayer && baitWasThrown)
{
UpdateHandsRotation();
}
if ((bool)fishingPlayer && !fishingPlayer.underwaterCamera.isTurnedOn)
{
if ((bool)fishingFloat)
{
UpdateFloatWeightPosition(false);
}
if ((bool)feeder)
{
feeder.UpdateFeederPosition(false);
}
}
if (!HUDManager.Instance.hudMultiplayer.isInInputMode && (bool)fishingPlayer && (fishingPlayer.currentState == FishingPlayer.PlayerState.FISHING || fishingPlayer.currentState == FishingPlayer.PlayerState.ICE_FISHING) && baitWasThrown && !fishingRod.isOnRodStand && (!isFlyRig || (bool)fishingPlayer.fish))
{
UpdateReelArm();
}
}
public void UpdateWaterRipples()
{
}
public void SetHandsRotation(float degreesToBait)
{
if (fishingPlayer.gameController.iceLevel)
{
return;
}
if (!fishingPlayer.IsSomethingOnBait() && throwObject.transform.position.y > 0f)
{
targetHandsLerp = 0f;
return;
}
handsAreMoving = 1f;
if (fishingRod.GetThrowObjectDistance() < 3f)
{
targetHandsLerp = 0f;
}
else if (handsAreMoving != 0f)
{
if (!fishingPlayer.IsSomethingOnBait())
{
degreesToBait *= 0.4f;
}
degreesToBait = Mathf.Clamp(degreesToBait, 0f - maxHandsRotation, maxHandsRotation);
targetHandsLerp = Mathf.InverseLerp(0f - maxHandsRotation, maxHandsRotation, degreesToBait);
targetHandsLerp = targetHandsLerp * 2f - 1f;
}
}
public void UpdateHandsRotation()
{
if (fishingPlayer.gameController.iceLevel)
{
return;
}
if (!useHandsRotation || VRManager.IsVROn())
{
transform.localPosition = Vector3.zero;
transform.localEulerAngles = Vector3.zero;
return;
}
currentHandsLerp = Mathf.MoveTowards(currentHandsLerp, targetHandsLerp, handsLerpSpeed * Time.deltaTime);
float t = handLerpCurve.Evaluate((!(currentHandsLerp >= 0f)) ? (0f - currentHandsLerp) : currentHandsLerp);
if (currentHandsLerp > 0f)
{
transform.localPosition = Vector3.Lerp(Vector3.zero, handsMaxRightPos * handsRotationFactor, t);
transform.localEulerAngles = Vector3.Lerp(Vector3.zero, handsMaxRightRot * handsRotationFactor, t);
}
else if (currentHandsLerp < 0f)
{
transform.localPosition = Vector3.Lerp(Vector3.zero, handsMaxLeftPos * handsRotationFactor, t);
transform.localEulerAngles = Vector3.Lerp(Vector3.zero, handsMaxLeftRot * handsRotationFactor, t);
}
else
{
transform.localPosition = Vector3.zero;
transform.localEulerAngles = Vector3.zero;
}
}
public IEnumerator StartFishing()
{
if ((bool)reel.arch)
{
reel.OpenArch(true);
yield return new WaitForSeconds(0.4f);
}
if (!isFlyRig)
{
animator.SetBool("StartFishing", true);
}
animator.SetBool("EndFishing", false);
animator.SetBool("QuickEndFishing", false);
animator.SetBool("Throw", false);
animator.SetBool("ThrowNear", false);
animator.SetBool("ThrowFly", false);
animator.speed = 1f;
fishingPlayer.gameController.hudManager.hudFishing.UpdateThrowStrength(0f);
yield return new WaitForSeconds(0.5f);
fishingPlayer.baitCanBeThrown = true;
fishingPlayer.gameController.hudManager.hudFishing.ShowThrowSlider(true);
RightArmFishing();
}
public void StartIceFishing()
{
if (VRManager.Instance.IsVRHoldRod())
{
ShowRod();
InitIceEquipment();
ThrowBaitNoSound();
}
else
{
animator.SetBool("StartIceFishing", true);
animator.SetBool("EndIceFishing", false);
}
}
public void Throw(float speed)
{
isThrowing = false;
isThrowingNear = false;
if (isFlyRig)
{
LeanTween.delayedCall(1f, (Action)delegate
{
animator.speed = Mathf.Lerp(throwAnimSpeed.x, throwAnimSpeed.y, speed);
});
animator.SetBool("ThrowFly", true);
}
else
{
animator.speed = Mathf.Lerp(throwAnimSpeed.x, throwAnimSpeed.y, speed);
animator.SetBool("Throw", true);
}
if ((bool)fishingFloat)
{
fishingFloat.StartThrowFloat();
}
bait.StartThrowBait();
if ((bool)TutorialManager.Instance)
{
TutorialManager.Instance.helpBlockNearThrow = false;
}
}
public void ThrowNear()
{
isThrowingNear = true;
animator.speed = 1f;
animator.SetBool("ThrowNear", true);
animator.SetBool("EndFishing", false);
animator.SetBool("QuickEndFishing", false);
throwObject.transform.position = fishingRod.baitThrowPosition.position;
currentRope.regenerateRope(true);
if ((bool)fishingFloat)
{
floatRope.regenerateRope(true);
}
RightArmFishing();
if ((bool)fishingFloat)
{
fishingFloat.StartThrowFloat();
}
bait.StartThrowBait();
fishingRod.StartBend();
}
public void ThrowBait()
{
if (!VRManager.Instance.IsVRHoldRod())
{
throwObject.transform.position = fishingRod.baitThrowPosition.position;
}
fishingPlayer.fishingController.ThrowBait(false);
AudioController.Play("Throw_01", transform.position);
animator.SetBool("ThrowNear", false);
animator.SetBool("ThrowFly", false);
}
public void ThrowBaitNear()
{
fishingPlayer.fishingController.ThrowBait(true);
AudioController.Play("Throw_Near_01", transform.position);
animator.SetBool("ThrowNear", false);
animator.SetBool("ThrowFly", false);
}
public void ThrowBaitFly()
{
fishingPlayer.fishingController.ThrowBait(false);
AudioController.Play("Throw_01", transform.position);
animator.SetBool("ThrowNear", false);
animator.SetBool("ThrowFly", false);
animator.SetBool("ThrowFlyCast", false);
}
public void ThrowBaitFlyCasting()
{
fishingPlayer.fishingController.ThrowBaitFlyCasting();
}
public void PrepareBaitNear()
{
fishingRod.ShowReelLine(true);
}
public void ThrowBaitNoSound()
{
}
public void InitIceEquipment()
{
fishingPlayer.ResetFishing();
fishingPlayer.fishingController.ThrowBait(false);
fishingRod.StartBend();
}
public void InitFlyCasting()
{
animator.SetBool("ThrowFly", false);
fishingPlayer.fishingController.InitFlyCasting();
}
public void StartFlyCasting()
{
animator.SetBool("ThrowFlyCast", true);
}
public void StopFishing(bool quick)
{
animator.SetBool("StartFishing", false);
if (quick)
{
animator.SetBool("QuickEndFishing", true);
}
else
{
animator.SetBool("EndFishing", true);
}
animator.SetBool("BaitHitWater", false);
fishingRod.ResetBend();
if ((bool)reel && (bool)reel.rotationAudioObject)
{
reel.rotationAudioObject.Pause();
reel.spoolAudioObject.Pause();
}
targetHandsLerp = 0f;
currentHandsLerp = 0f;
if (quick)
{
LeanTween.moveLocal(base.gameObject, Vector3.zero, 0.3f);
LeanTween.rotateLocal(base.gameObject, Vector3.zero, 0.3f);
}
else
{
transform.localPosition = Vector3.zero;
transform.localEulerAngles = Vector3.zero;
}
if (VRManager.IsVROn())
{
DestroyArmJoint();
}
RightArmWalking();
}
public void StopIceFishing()
{
if (!VRManager.Instance.IsVRHoldRod())
{
animator.SetBool("StartIceFishing", false);
animator.SetBool("EndIceFishing", true);
}
fishingRod.ResetBend();
fishingPlayer.ResetFishing();
iceRope.regenerateRope(false);
throwObject.GetComponent<Rigidbody>().isKinematic = true;
if ((bool)reel && (bool)reel.rotationAudioObject)
{
reel.rotationAudioObject.Pause();
reel.spoolAudioObject.Pause();
}
if (VRManager.Instance.IsVRHoldRod())
{
HideRod();
HideRopes();
}
}
public void RestAnimSpeed()
{
animator.speed = 1f;
}
public void CloseArch()
{
reel.OpenArch(false);
}
public void ShowArmRenderers(bool show)
{
if (VRManager.IsVROn())
{
return;
}
foreach (SkinnedMeshRenderer armsMeshRenderer in armsMeshRenderers)
{
armsMeshRenderer.enabled = show;
}
}
public void ToggleArmRenderers()
{
ShowArmRenderers(!armsMeshRenderers[0].enabled);
}
public void ToggleVRArmRenderers()
{
foreach (SkinnedMeshRenderer armsMeshRenderer in armsMeshRenderers)
{
if (armsMeshRenderer.name == "hand_left" || armsMeshRenderer.name == "hand_right")
{
armsMeshRenderer.material = vrHandsMaterial;
}
else
{
armsMeshRenderer.enabled = false;
}
}
}
public void ShowLeftArm()
{
leftArm.SetActive(true);
}
public void HideLeftArm()
{
leftArm.SetActive(false);
animator.speed = 1f;
drinkParent.gameObject.SetActive(false);
foodParent.gameObject.SetActive(false);
filletParent.gameObject.SetActive(false);
attractorParent.gameObject.SetActive(false);
gasStove.gameObject.SetActive(false);
gasStove.fryingPanParent.gameObject.SetActive(false);
knifeParent.gameObject.SetActive(false);
if ((bool)fishingPlayer)
{
fishingPlayer.isDrinking = false;
fishingPlayer.isEating = false;
}
Debug.Log("HideLeftArm");
}
public void ShowRightArm()
{
rightArm.SetActive(true);
ActivateRopes(true);
}
public void HideRightArm()
{
rightArm.SetActive(false);
ActivateRopes(false);
}
public void ActivateRopes(bool activate)
{
currentRope.gameObject.SetActive(activate);
if ((bool)fishingFloat)
{
fishingFloat.gameObject.SetActive(activate);
floatRope.gameObject.SetActive(activate);
}
}
public void RightArmDown()
{
}
public void RightArmUp()
{
}
public void RightArmWalking()
{
if (!VRManager.IsVROn())
{
LeanTween.moveLocal(rightArm.gameObject, rightArmWalkingPos, 0.5f);
}
}
public void RightArmFishing()
{
if (!VRManager.IsVROn())
{
if (isFlyRig)
{
LeanTween.moveLocal(rightArm.gameObject, rightArmFlyFishingPos, 1.5f);
}
else
{
LeanTween.moveLocal(rightArm.gameObject, (reel.reelType != FishingReel.ReelType.LINE_COUNTER) ? rightArmFishingPos : rightArmMultiplikatorPos, 0.5f);
}
}
}
public void ShowWalkingDriller(bool show)
{
if ((bool)GlobalSettings.Instance && !GlobalSettings.Instance.equipmentManager.FindEquipment(EquipmentObject.EquipmentType.OTHER, "DRILLER_01").isBought)
{
show = false;
}
if ((bool)drillerWalking)
{
drillerWalking.gameObject.SetActive(show);
}
if (show)
{
HideLeftArm();
}
ShowArmRenderers(!show);
}
public void PlaySoundShowArm()
{
AudioController.Play("ArmShow_01", transform);
}
public void PlaySoundHideArm()
{
AudioController.Play("ArmHide_01", transform);
}
public void PlaySoundFillet()
{
AudioController.Play("MakeFilletShort_01", transform);
}
public void PlaySoundEat()
{
AudioController.Play("EatShort_01", transform);
}
public void HideHandsCamera(bool hide, bool withMessage = true)
{
if (hide)
{
if (fishingPlayer.currentState == FishingPlayer.PlayerState.ICE_FISHING)
{
fishingPlayer.fishingController.FinishIceFishing();
}
if (withMessage)
{
fishingPlayer.gameController.hudManager.ShowMessageWindow(true, Utilities.GetTranslation("HUD_MESSAGE/NO_ROD_REEL_LINE"));
}
if (fishingPlayer.isHandsCameraVisible == hide)
{
if (VRManager.IsVROn())
{
fishingPlayer.ufpsCameraCamera.cullingMask = Utilities.RemoveFromLayerMask(fishingPlayer.ufpsCameraCamera.cullingMask, "Weapon");
}
else
{
fishingPlayer.ufpsWeaponCamera.cullingMask = Utilities.RemoveFromLayerMask(fishingPlayer.ufpsWeaponCamera.cullingMask, "Weapon");
}
}
}
else if (fishingPlayer.isHandsCameraVisible == hide)
{
if (VRManager.IsVROn())
{
fishingPlayer.ufpsCameraCamera.cullingMask = Utilities.AddToLayerMask(fishingPlayer.ufpsCameraCamera.cullingMask, "Weapon");
}
else
{
fishingPlayer.ufpsWeaponCamera.cullingMask = Utilities.AddToLayerMask(fishingPlayer.ufpsWeaponCamera.cullingMask, "Weapon");
}
}
fishingPlayer.isHandsCameraVisible = !hide;
}
public void HideHandsLayer(bool hide)
{
Utilities.SetLayerRecursively(base.gameObject, LayerMask.NameToLayer((!hide) ? "Weapon" : "TransparentFX"));
Utilities.SetLayerRecursively(reelLineParent.gameObject, LayerMask.NameToLayer("Weapon"));
}
public void ShowWatchFishRopes()
{
Utilities.SetLayerRecursively(currentRope.gameObject, "TransparentFX");
if ((bool)bait)
{
bait.UpdateLayers("Weapon", false);
}
for (int i = 0; i < floatWeights.Count; i++)
{
Utilities.SetLayerRecursively(floatWeights[i].gameObject, "TransparentFX");
}
if ((bool)fishingFloat)
{
Utilities.SetLayerRecursively(floatRope.gameObject, "TransparentFX");
Utilities.SetLayerRecursively(fishingFloat.gameObject, "TransparentFX");
}
}
public void ShowRopes(bool show)
{
Utilities.SetLayerRecursively(currentRope.gameObject, (!show) ? "TransparentFX" : "Weapon");
if ((bool)bait)
{
bait.UpdateLayers((!show) ? "TransparentFX" : ((!GameController.Instance.iceLevel) ? "Weapon" : "Bait"), false);
}
if ((bool)fishingFloat)
{
Utilities.SetLayerRecursively(floatRope.gameObject, (!show) ? "TransparentFX" : "Weapon");
Utilities.SetLayerRecursively(fishingFloat.gameObject, (!show) ? "TransparentFX" : "Weapon");
}
}
[Button]
public void HideRopes()
{
ShowRopes(false);
}
public void ShowRod()
{
if ((bool)fishingRod)
{
Utilities.SetLayerRecursively(fishingRod.gameObject, "Weapon");
Utilities.SetLayerRecursively(currentRope.gameObject, (!fishingPlayer.gameController.iceLevel) ? "Weapon" : "Default");
Utilities.SetLayerRecursively(floatRope.gameObject, (!fishingPlayer.gameController.iceLevel) ? "Weapon" : "Default");
Utilities.SetLayerRecursively(reelLineParent.gameObject, "Weapon");
}
}
public void HideRod()
{
if ((bool)fishingRod)
{
Utilities.SetLayerRecursively(fishingRod.gameObject, "TransparentFX");
Utilities.SetLayerRecursively(currentRope.gameObject, "TransparentFX");
Utilities.SetLayerRecursively(floatRope.gameObject, "TransparentFX");
Utilities.SetLayerRecursively(reelLineParent.gameObject, "TransparentFX");
}
}
public void ShowKnife()
{
knifeParent.gameObject.SetActive(true);
}
public void HideKnife()
{
knifeParent.gameObject.SetActive(false);
}
public void ShowFillet()
{
filletParent.gameObject.SetActive(true);
}
public void HideFillet()
{
filletParent.gameObject.SetActive(false);
}
public void ShowFlyLines(bool show)
{
fly2ReelLineParent.gameObject.SetActive(show);
}
public void CreateFlyArmJoint(float throwStrength)
{
if (VRManager.Instance.IsVRReeling())
{
leftArmReelParent.transform.parent = VRControllersManager.Instance.GetVRController(VRControllersManager.Instance.GetSecondaryController()).flyHandTransform;
leftArmReelParent.localPosition = Vector3.zero;
leftArmReelParent.localEulerAngles = Vector3.zero;
}
else
{
leftArmReelParent.position = reel.handMountPosition.position;
}
ShowLeftArm();
updateLeftArmFly = !VRManager.Instance.IsVRReeling();
watchHandsPosition.parent.localEulerAngles = new Vector3(-5f, -10f, -25f);
watchHandsPosition.parent.parent.localEulerAngles = new Vector3(0f, 10f, 4f);
reel.spoolAudioObject.pitch = 1f;
reel.spoolAudioObject.volume = reel.spoolAudioObject.audioItem.Volume * reel.spoolAudioObject.subItem.Volume * 0.4f;
reel.spoolAudioObject.Unpause();
reel.isReelingOut = true;
if (!VRManager.Instance.IsVRReeling())
{
Vector3 to = flyArmStartPos.localPosition - Vector3.right * Mathf.Lerp(-0.2f, 1.5f, throwStrength);
LTDescr lTDescr = LeanTween.moveLocal(leftArmReelParent.gameObject, to, Mathf.Lerp(0.4f, 0.9f, throwStrength)).setOnUpdate((Action<Vector3>)delegate
{
reel.isReelingOut = true;
}, (object)null).setOnComplete((Action)delegate
{
LeanTween.moveLocal(leftArmReelParent.gameObject, flyArmStartPos.localPosition, 0.5f).setEaseInOutElastic().setDelay(1f);
if (!VRManager.IsVROn())
{
Throw(throwStrength);
}
})
.setEaseInOutQuad();
}
ShowFlyLines(true);
}
public void CreateArmJoint()
{
if (fishingPlayer.gameController.iceLevel)
{
leftArmReelParent.gameObject.transform.position = reel.handMountPosition.position;
ShowLeftArm();
updateLeftArmPos = true;
return;
}
if (isFlyRig && !updateLeftArmPos)
{
updateLeftArmPos = true;
fishingPlayer.ufpsInput.AllowGameplayInput = true;
return;
}
updateLeftArmFly = false;
leftArmReelParent.position = reel.handMountPosition.position + leftArmIdleOffset;
if (!VRManager.Instance.IsVRReeling())
{
ShowLeftArm();
}
ShowFlyLines(false);
LeanTween.value(0f, 1f, 0.3f).setOnUpdate((Action<float>)delegate
{
leftArmReelParent.position = Vector3.MoveTowards(leftArmReelParent.position, reel.handMountPosition.position, 0.6f * Time.deltaTime);
}).setOnComplete((Action)delegate
{
updateLeftArmPos = true;
if ((bool)fishingPlayer.boatSimulator)
{
fishingPlayer.boatSimulator.PauseFloating(false);
}
if (!fishingPlayer.gameController.iceLevel)
{
fishingPlayer.ufpsInput.AllowGameplayInput = true;
fishingPlayer.BlockMouseLook(false, 2f);
fishingPlayer.TurnOnSpring(true);
}
});
}
public void DestroyArmJoint()
{
if (VRManager.IsVROn())
{
leftArmReelParent.transform.parent = leftArm.transform;
leftArmReelParent.localEulerAngles = Vector3.zero;
}
if (fishingPlayer.gameController.iceLevel)
{
leftArmReelParent.localPosition = leftArmReelParentStartPos;
}
else if (!VRManager.IsVROn())
{
LeanTween.moveLocal(leftArmReelParent.gameObject, leftArmReelParent.localPosition + new Vector3(-0.7f, -0.5f, 0f), 0.9f).setOnComplete((Action)delegate
{
leftArmReelParent.localPosition = leftArmReelParentStartPos;
});
}
updateLeftArmPos = false;
updateLeftArmFly = false;
ShowFlyLines(false);
}
public void DestroyArmJointQuick()
{
if (VRManager.IsVROn())
{
leftArmReelParent.transform.parent = leftArm.transform;
leftArmReelParent.localEulerAngles = Vector3.zero;
}
leftArmReelParent.localPosition = leftArmReelParentStartPos;
updateLeftArmPos = false;
updateLeftArmFly = false;
ShowFlyLines(false);
}
public void UpdateReelArm()
{
if (!updateLeftArmPos)
{
return;
}
if (isFlyRig && !fishingPlayer.fish)
{
if (!VRManager.Instance.IsVRReeling())
{
return;
}
vrRopePullDelay -= Time.deltaTime;
if (vrRopePullDelay < 0f)
{
vrRopeIsReelingIn = false;
}
if (updateLeftArmFly)
{
if (UtilitiesInput.GetButtonUp("VR_FLY_GRIP"))
{
UtilitiesInput.SetVibration(0, false, 0.1f, 0.1f);
updateLeftArmFly = false;
vrRopePullDelay = 1f;
}
float num = Vector3.Distance(VRControllersManager.Instance.GetVRController(VRControllersManager.Instance.GetSecondaryController()).flyHandTransform.position, vrRopeCatchPosition);
if (num > vrRopeMaxDistanceFromStart)
{
vrRopeMaxDistanceFromStart = num;
vrRopeIsReelingIn = true;
vrRopePullDelay = 0.2f;
}
}
else if (UtilitiesInput.GetButtonDown("VR_FLY_GRIP"))
{
Transform flyHandTransform = VRControllersManager.Instance.GetVRController(VRControllersManager.Instance.GetSecondaryController()).flyHandTransform;
vrRopeCatchPosition = Utilities.NearestPointOnFiniteLine(reel.reelLineFinish.position, fishingRod.reelLineAttach.position, flyHandTransform.position);
float num2 = Vector3.Distance(flyHandTransform.position, vrRopeCatchPosition);
if (num2 < 0.3f && !updateLeftArmFly)
{
UtilitiesInput.SetVibration(0, false, 0.2f, 0.2f);
vrRopeMaxDistanceFromStart = 0f;
updateLeftArmFly = true;
}
}
}
else
{
leftArmReelParent.transform.parent = leftArm.transform;
leftArmReelParent.localEulerAngles = Vector3.zero;
leftArmReelParent.position = reel.handMountPosition.position;
if (isFlyRig)
{
leftArmReelParent.position += leftArmReelParent.position - leftArmReelParentOffset.position;
}
}
}
public void UpdateCurrentReelSpeed()
{
targetReelSpeed = currentUserReelSpeed;
if ((bool)fishingPlayer.fish)
{
if (!fishingLine.isLoose)
{
float num = 1f;
if (fishingPlayer.PlayerFishStrengthDiff < 0f)
{
num = Mathf.Lerp(0.05f, 1f, 1f - Mathf.Clamp01(0f - fishingPlayer.PlayerFishStrengthDiff));
}
targetReelSpeed = currentUserReelSpeed * num;
}
}
else if ((bool)fishingPlayer.junk && !fishingLine.isLoose)
{
targetReelSpeed *= 1f - Mathf.Lerp(0f, 0.9f, fishingPlayer.junk.weight / 10f);
}
currentReelSpeed = Mathf.MoveTowards(currentReelSpeed, targetReelSpeed, Time.deltaTime * changeReelSpeedFactor);
}
public float GetCurrentReelRotationSpeed()
{
if (fishingPlayer.gameController.iceLevel)
{
return Mathf.Lerp(reelIceSpeed.x, reelIceSpeed.y, currentReelSpeed);
}
return Mathf.Lerp(reelSpeed.x, reelSpeed.y, currentReelSpeed);
}
public void CalculateEquipmentDurability()
{
if (!equipmentManager || equipmentManager.CheckMinimumRequiredEquipment())
{
float num = 1f;
if (fishingLine.durability < num)
{
num = fishingLine.durability;
}
if (reel.durability < num)
{
num = reel.durability;
}
if (fishingRod.durability < num)
{
num = fishingRod.durability;
}
num = (fishingLine.durability + reel.durability + fishingRod.durability) / 3f;
equipmentDurability = num;
}
}
public float GetEquipmentDurability()
{
return equipmentDurability;
}
public float UpdateJerkFactor(float val)
{
if (fishingPlayer.isJerkOn)
{
return val * 1.6f;
}
return val;
}
public float UpdateHandsRotationFactor(float val)
{
return val * Mathf.Lerp(1f, 1.5f, Mathf.Abs(currentHandsLerp));
}
public float UpdateReelSpeedFactor(float val)
{
return val * Mathf.Lerp(1f, 3f, Mathf.Abs(currentUserReelSpeed));
}
public void ChangeShirtMaterial(int materialId)
{
foreach (SkinnedMeshRenderer shirtObject in shirtObjects)
{
shirtObject.material = shirtMaterials[materialId];
}
}
public void ResetThrowFakeObject()
{
Utilities.SetLayerRecursively(throwFakeObject.gameObject, "TransparentFX");
throwFakeObject.isKinematic = true;
throwFakeObject.transform.position = fishingRod.rodEndPosition.position;
throwFakeObject.gameObject.SetActive(false);
}
public void ThrowObjectHitWater()
{
if (!throwFakeObject.isKinematic)
{
ResetThrowFakeObject();
fishingPlayer.gameController.junkManager.CheckJunkChance();
fishingPlayer.gameController.hudManager.UpdateControls();
if (!fishingPlayer.gameController.iceLevel)
{
CloseArch();
LeanTween.delayedCall(0.7f, CreateArmJoint);
animator.SetBool("BaitHitWater", true);
}
if (!isThrowingNear)
{
fishingRod.StartBend();
}
FishingController.baitHitWaterTimer = 10f;
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.REEL_01, 1.3f);
if (isFlyRig)
{
TutorialManager.Instance.ShowTutorial(TutorialManager.TutorialsId.FLY_FISHING_02, 1.3f);
}
}
}
public bool ThrowObjectOnWater()
{
if (bait == null)
{
return false;
}
if (throwObject == bait.gameObject)
{
return bait.isOnWater;
}
return fishingFloat.isOnWater;
}
public void ShakeHandsWhileReeling(bool shake)
{
if (!VRManager.IsVROn())
{
if (shake)
{
leanShakeReeling.setTime(Mathf.Lerp(shakeReelingTime.x, shakeReelingTime.y, 1f - currentReelSpeed));
}
if (shake && leanShakeReeling.direction == 0f)
{
leanShakeReeling.resume();
}
else if (!shake && leanShakeReeling.direction != 0f)
{
leanShakeReeling.pause();
}
}
}
public void UpdateWatchFishLine(Transform target)
{
watchFishLine.transform.parent.position = target.position;
if (GameController.Instance.iceLevel)
{
watchFishLine.transform.parent.eulerAngles = new Vector3(-90f, 0f, 0f);
}
else
{
watchFishLine.transform.parent.LookAt(fishingRod.rodMegaAttachPosition);
}
watchFishLine.transform.localScale = new Vector3(watchFishLine.transform.localScale.x, Vector3.Distance(watchFishLine.transform.position, fishingRod.rodMegaAttachPosition.position), watchFishLine.transform.localScale.z);
}
public void CheckHasHook()
{
Debug.Log("CheckRequiredEquipment");
hasRequiredEquipments = true;
if (bait == null || !bait.CheckRequiredEquipment())
{
hasRequiredEquipments = false;
Debug.Log("CheckRequiredEquipment: NO HOOK");
fishingPlayer.gameController.hudManager.ShowMessageWindow(true, Utilities.GetTranslation("HUD_MESSAGE/NO_HOOK"));
ShowRopes(false);
if (fishingPlayer.currentState == FishingPlayer.PlayerState.ICE_FISHING)
{
fishingPlayer.fishingController.FinishIceFishing();
}
}
else
{
fishingPlayer.gameController.hudManager.ShowMessageWindow(false, string.Empty);
ShowRopes(!GameController.Instance.iceLevel);
}
if (hasRequiredEquipments)
{
}
}
public void JerkPump(bool jerk, float forceFactor = 5f)
{
if (!VRManager.Instance.IsVRHoldRod())
{
float num = 0f;
if (jerk)
{
targetJerkBlend = currentJerkBlend + jerkBlendInc * forceFactor;
}
else
{
targetJerkBlend = 0f;
jerkCanBeStopped = true;
freezeJerkDownTimer = 0.05f;
}
targetJerkBlend = Mathf.Clamp01(targetJerkBlend);
float num2 = targetJerkBlend - currentJerkBlend;
num = pullForceJerk * num2;
if (!jerk || !(currentJerkBlend < 1f) || !fishingPlayer.fish || !fishingLine.isLoose)
{
}
fishingPlayer.isJerkOn = jerk;
if (jerk)
{
spinningMethodController.SpinningStateEvent(SpinningMethodController.SpinningState.JERK);
}
}
}
public IEnumerator SmallJerk()
{
if (!isSmalllJerking)
{
float jerkForce = 0f;
float prevJerkBlend = currentJerkBlend;
targetJerkBlend = currentJerkBlend + jerkBlendInc;
targetJerkBlend = Mathf.Clamp01(targetJerkBlend);
isSmalllJerking = true;
yield return new WaitForSeconds(0.1f);
targetJerkBlend = prevJerkBlend;
yield return new WaitForSeconds(0.3f);
isSmalllJerking = false;
}
}
public void StopFullJerk()
{
if (targetJerkBlend >= 1f && jerkCanBeStopped)
{
targetJerkBlend = currentJerkBlend;
Debug.Log("StopFullJerk");
}
}
public void ResetJerkBlend()
{
currentJerkBlend = (targetJerkBlend = 0f);
animator.SetFloat("JerkBlend", currentJerkBlend);
}
public void UpdateJerkBlend()
{
if (freezeJerkDownTimer > 0f)
{
freezeJerkDownTimer -= Time.deltaTime;
if (targetJerkBlend < currentJerkBlend)
{
return;
}
}
float target = 1f;
if (targetJerkBlend > currentJerkBlend && fishingPlayer.IsSomethingOnBait() && !fishingLine.isLoose)
{
target = Mathf.Lerp(1.5f, 12f, (!fishingPlayer.fish) ? (fishingPlayer.junk.weight * 0.1f) : fishingPlayer.fish.GetCurrentStrengthFactor());
if (reel.GetDragForce() > 0f)
{
fishingLine.pumpTension += 0.65f * reel.GetDragForce() * Time.deltaTime;
if ((bool)fishingPlayer.fish)
{
StartCoroutine(fishingPlayer.fish.PullForce(pullForceJerk * Time.deltaTime));
}
}
}
currentJerkSpeed = Mathf.MoveTowards(currentJerkSpeed, target, 20f * Time.deltaTime);
currentJerkBlend = Mathf.MoveTowards(currentJerkBlend, targetJerkBlend, ((!(targetJerkBlend > currentJerkBlend)) ? jerkBlendSpeed.y : (jerkBlendSpeed.x / currentJerkSpeed)) * Time.deltaTime);
float num = jerkBendCurve.Evaluate(currentJerkBlend) * 0.5f;
if (isFlyRig)
{
num = 1f - num;
}
animator.SetFloat("JerkBlend", num);
}
public void ThrowExplosive()
{
if (animator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
{
InitExplosive();
fishingPlayer.isThrowingExplosive = true;
animator.SetBool("ThrowExplosive", true);
}
}
public void ThrowExplosiveEvent()
{
currentExplosive.Throw();
Vector3 vector = fishingPlayer.ufpsWeaponCamera.transform.forward + new Vector3(0f, fishingPlayer.fishingController.throwExplosiveVector.y, 0f) + fishingPlayer.ufpsController.Velocity * 0.1f;
vector = Quaternion.AngleAxis(fishingPlayer.fishingController.throwExplosiveVector.x, Vector3.up) * vector;
currentExplosive.rigidbody.AddForce(vector * (fishingPlayer.fishingController.throwStrengthExplosive + 300f * fishingPlayer.GetCurrentStrength()));
currentExplosive.rigidbody.AddRelativeTorque(new Vector3(-20f, 0f, 0f));
Debug.DrawLine(currentExplosive.transform.position, currentExplosive.transform.position + vector * 10f, Color.black, 10f);
Debug.DrawLine(currentExplosive.transform.position, currentExplosive.transform.position + fishingPlayer.ufpsWeaponCamera.transform.forward * 10f, Color.white, 10f);
currentExplosive.transform.parent = null;
Utilities.SetLayerRecursively(currentExplosive.gameObject, "Default");
currentExplosive = null;
animator.SetBool("ThrowExplosive", false);
}
public void InitExplosive()
{
currentExplosive = UnityEngine.Object.Instantiate(explosivePrefab);
currentExplosive.transform.parent = explosiveParent;
currentExplosive.transform.localPosition = Vector3.zero;
currentExplosive.transform.localRotation = Quaternion.identity;
Utilities.SetLayerRecursively(currentExplosive.gameObject, "Weapon");
}
public void RemovePinEvent()
{
currentExplosive.RemovePin();
}
public void ThrowBoilie()
{
if (!animator.GetCurrentAnimatorStateInfo(0).IsName("Idle"))
{
return;
}
if (boiliePrefab == null)
{
Debug.LogError("ThrowBoilie boiliePrefab == null");
return;
}
InitBoilie();
if (VRManager.Instance.IsVRGroundBait())
{
HUDManager.Instance.UpdateControlsVR();
return;
}
fishingPlayer.isThrowingExplosive = true;
animator.SetBool("ThrowBoilie", true);
fishingPlayer.ufpsInput.AllowGameplayInput = false;
fishingPlayer.BlockMouseLook(true);
LeanTween.delayedCall(2.5f, (Action)delegate
{
fishingPlayer.isThrowingExplosive = false;
});
}
public void ThrowBoilieEvent()
{
if (currentBoilie == null)
{
Debug.LogError("ThrowBoilieEvent currentBoilie == null");
return;
}
currentBoilie.Throw();
if (VRManager.Instance.IsVRGroundBait())
{
currentBoilie.rigidbody.AddForce(fishingPlayer.transform.rotation * OVRInput.GetLocalControllerVelocity(VRControllersManager.Instance.GetSecondaryController()) * 180f);
currentBoilie.rigidbody.angularVelocity = OVRInput.GetLocalControllerAngularVelocity(VRControllersManager.Instance.GetSecondaryController());
}
else
{
Vector3 vector = ((!VRManager.IsVROn() || VRManager.Instance.IsControllersInput()) ? fishingPlayer.ufpsWeaponCamera.transform.forward : fishingPlayer.GetForwardVector());
vector += new Vector3(0f, fishingPlayer.fishingController.throwExplosiveVector.y, 0f) + fishingPlayer.ufpsController.Velocity * 0.1f;
vector = Quaternion.AngleAxis(fishingPlayer.fishingController.throwExplosiveVector.x, Vector3.up) * vector;
currentBoilie.rigidbody.AddForce(vector * (fishingPlayer.fishingController.throwStrengthExplosive + 300f * fishingPlayer.GetCurrentStrength()));
currentBoilie.rigidbody.AddRelativeTorque(new Vector3(-20f, 0f, 0f));
Debug.DrawLine(currentBoilie.transform.position, currentBoilie.transform.position + vector * 10f, Color.black, 10f);
Debug.DrawLine(currentBoilie.transform.position, currentBoilie.transform.position + fishingPlayer.ufpsWeaponCamera.transform.forward * 10f, Color.white, 10f);
}
currentBoilie.transform.parent = null;
Utilities.SetLayerRecursively(currentBoilie.gameObject, "Boilie");
currentBoilie = null;
HUDManager.Instance.UpdateControlsVR();
animator.SetBool("ThrowBoilie", false);
}
public void ThrowBoilieSound()
{
AudioController.Play("Boilie_Throw_01");
}
public void ThrowBoilieFinishEvent()
{
fishingPlayer.ufpsInput.AllowGameplayInput = true;
fishingPlayer.BlockMouseLook(false);
}
public void InitBoilie()
{
currentBoilie = UnityEngine.Object.Instantiate(boiliePrefab);
if (VRManager.Instance.IsVRGroundBait())
{
currentBoilie.transform.parent = VRControllersManager.Instance.GetVRController(VRControllersManager.Instance.GetSecondaryController()).throwObjectTransform;
}
else
{
currentBoilie.transform.parent = boilieParent;
}
currentBoilie.transform.localPosition = Vector3.zero;
currentBoilie.transform.localRotation = Quaternion.identity;
Utilities.SetLayerRecursively(currentBoilie.gameObject, "Weapon");
}
public void ThrowBoilieIce()
{
if (boiliePrefab == null)
{
Debug.LogError("ThrowBoilieIce boiliePrefab == null");
return;
}
fishingPlayer.isThrowingExplosive = true;
currentBoilie = UnityEngine.Object.Instantiate(boiliePrefab);
currentBoilie.transform.localPosition = fishingPlayer.drillingController.currentHole.holeCenter.position + Vector3.up * 0.15f;
currentBoilie.transform.localRotation = Quaternion.identity;
currentBoilie.transform.localScale = Vector3.one * 0.75f;
currentBoilie.Throw();
currentBoilie.canHitWater = true;
Utilities.SetLayerRecursively(currentBoilie.gameObject, "Boilie");
currentBoilie = null;
LeanTween.delayedCall(1.5f, (Action)delegate
{
fishingPlayer.isThrowingExplosive = false;
});
}
public IEnumerator Drink()
{
drinkParent.gameObject.SetActive(true);
fishingPlayer.isDrinking = true;
AudioController.Play("Drink_Open_01", fishingPlayer.transform);
yield return new WaitForSeconds(0.5f);
animator.SetBool("Drink", true);
}
public void DrinkStartEvent()
{
audioDrinking = AudioController.Play("Drink_01", fishingPlayer.transform);
animator.SetBool("Drink", false);
}
public void DrinkFinishEvent()
{
if ((bool)audioDrinking)
{
audioDrinking.Stop();
}
audioDrinking = null;
LeanTween.delayedCall(base.gameObject, 0.5f, (Action)delegate
{
AudioController.Play("Drink_Sigh_01", fishingPlayer.transform);
});
}
public void Eat()
{
foodParent.gameObject.SetActive(true);
fishingPlayer.isEating = true;
animator.SetBool("Eat", true);
}
public void EatStartEvent()
{
audioEating = AudioController.Play("Eat_02", fishingPlayer.transform);
animator.SetBool("Eat", false);
}
public void EatFinishEvent()
{
if ((bool)audioEating)
{
audioEating.Stop();
}
audioEating = null;
}
public void ShowAttractor()
{
fishingPlayer.ChangeState(FishingPlayer.PlayerState.ATTRACTOR);
ShowAttractorObject();
animator.SetBool("Attractor", true);
}
public void HideAttractor()
{
fishingPlayer.ChangeState(FishingPlayer.PlayerState.NORMAL);
animator.SetBool("Attractor", false);
attractor.HideAttractor();
}
public void ShowAttractorObject()
{
ShowLeftArm();
attractorParent.gameObject.SetActive(true);
}
public void TakeRod()
{
fishingRod.transform.parent = fishingRodMountPosition;
if (fishingRod.fishingHands.reel.reelType == FishingReel.ReelType.LINE_COUNTER)
{
fishingRod.transform.localEulerAngles = new Vector3(0f, 180f, 0f);
if ((bool)fishingRod.handMultiMountPosition)
{
fishingRod.transform.localPosition = -fishingRod.handMultiMountPosition.localPosition;
}
}
else
{
fishingRod.transform.localEulerAngles = Vector3.zero;
fishingRod.transform.localPosition = -fishingRod.handMountPosition.localPosition;
}
fishingRod.fishingHands.normalRope.transform.parent = fishingRod.fishingHands.transform;
fishingRod.fishingHands.normalRope.transform.localScale = Vector3.one;
fishingRod.fishingHands.reelLineParent.transform.parent = fishingRod.fishingHands.transform;
currentRope.regenerateRope(true);
}
[Button]
public void SpinningSet()
{
fishingRodPrefab = testSpinningRod;
reelPrefab = testSpinningReel;
fishingLinePrefab = testSpinningLine;
baitPrefab = testSpinningBait;
fishingFloatPrefab = null;
feederPrefab = null;
}
[Button]
public void FloatSet()
{
fishingRodPrefab = testSpinningRod;
reelPrefab = testSpinningReel;
fishingLinePrefab = testSpinningLine;
baitPrefab = testHook;
fishingFloatPrefab = testFloat;
feederPrefab = null;
}
[Button]
public void FeederSet()
{
fishingRodPrefab = testSpinningRod;
reelPrefab = testSpinningReel;
fishingLinePrefab = testSpinningLine;
baitPrefab = testHook;
fishingFloatPrefab = null;
feederPrefab = testFeeder;
rodStandPrefab = testRodStand;
}
[Button]
public void FlySet()
{
fishingRodPrefab = testFlyRod;
reelPrefab = testFlyReel;
fishingLinePrefab = testFlyLine;
baitPrefab = testFlyBait;
fishingFloatPrefab = null;
feederPrefab = null;
}
[Button]
public void MarlinSet()
{
fishingRodPrefab = testMarlinRod;
reelPrefab = testMarlinReel;
fishingLinePrefab = testMarlinLine;
baitPrefab = testMarlinBait;
fishingFloatPrefab = null;
feederPrefab = null;
}
[Button]
public void MarlinBigSet()
{
fishingRodPrefab = testMarlinBigRod;
reelPrefab = testMarlinBigReel;
fishingLinePrefab = testMarlinBigLine;
baitPrefab = testMarlinBait;
fishingFloatPrefab = null;
feederPrefab = null;
}
}