// Token: 0x06000D3F RID: 3391 RVA: 0x0005E99C File Offset: 0x0005CB9C private void RandomizeWaypoint(bool canHook) { Vector2 vector = UnityEngine.Random.insideUnitCircle * this.m_swimRange; this.m_waypoint = this.m_spawnPoint + new Vector3(vector.x, 0f, vector.y); this.m_waypointFF = null; if (canHook) { FishingFloat fishingFloat = this.FindFloat(); if (fishingFloat) { this.m_waypointFF = fishingFloat; this.m_waypoint = fishingFloat.transform.position + Vector3.down; } } float pointDepth = this.GetPointDepth(this.m_waypoint); if (pointDepth < this.m_minDepth) { return; } Vector3 p = (this.m_waypoint + base.transform.position) * 0.5f; if (this.GetPointDepth(p) < this.m_minDepth) { return; } float max = Mathf.Min(this.m_maxDepth, pointDepth - this.m_height); float waterLevel = WaterVolume.GetWaterLevel(this.m_waypoint, 1f); this.m_waypoint.y = waterLevel - UnityEngine.Random.Range(this.m_minDepth, max); this.m_haveWaypoint = true; this.m_swimTimer = UnityEngine.Random.Range(this.m_wpDurationMin, this.m_wpDurationMax); }
static void Postfix(ref FishingFloat __instance) { if (modEnabled.Value) { __instance.m_hookedStaminaPerSec = hookedStaminaPerSec.Value; } }
private void Update() { foreach (FishingFloat instance in FishingFloat.GetAllInstances()) { if (instance.GetOwner() == Player.m_localPlayer) { fishingFloat = instance; isFishing = true; return; } } isFishing = false; }
// Token: 0x06000D3E RID: 3390 RVA: 0x0005E900 File Offset: 0x0005CB00 private FishingFloat FindFloat() { foreach (FishingFloat fishingFloat in FishingFloat.GetAllInstances()) { if (Vector3.Distance(base.transform.position, fishingFloat.transform.position) <= fishingFloat.m_range && fishingFloat.IsInWater() && !(fishingFloat.GetCatch() != null)) { float baseHookChance = this.m_baseHookChance; if (UnityEngine.Random.value < baseHookChance) { return(fishingFloat); } } } return(null); }
// Token: 0x06000D48 RID: 3400 RVA: 0x0005ECB0 File Offset: 0x0005CEB0 public void Setup(Character owner, Vector3 velocity, float hitNoise, HitData hitData, ItemDrop.ItemData item) { FishingFloat fishingFloat = FishingFloat.FindFloat(owner); if (fishingFloat) { ZNetScene.instance.Destroy(fishingFloat.gameObject); } ZDOID zdoid = owner.GetZDOID(); this.m_nview.GetZDO().Set("RodOwner", zdoid); FishingFloat.m_allInstances.Add(this); Transform rodTop = this.GetRodTop(owner); if (rodTop == null) { ZLog.LogWarning("Failed to find fishing rod top"); return; } this.m_rodLine.SetPeer(owner.GetZDOID()); this.m_lineLength = Vector3.Distance(rodTop.position, base.transform.position); owner.Message(MessageHud.MessageType.Center, this.m_lineLength.ToString("0m"), 0, null); }
// Token: 0x06000D3B RID: 3387 RVA: 0x0005E4C8 File Offset: 0x0005C6C8 private void FixedUpdate() { if (!this.m_nview.IsValid()) { return; } float fixedDeltaTime = Time.fixedDeltaTime; if (!this.m_nview.IsOwner()) { return; } FishingFloat fishingFloat = FishingFloat.FindFloat(this); if (fishingFloat) { Utils.Pull(this.m_body, fishingFloat.transform.position, 1f, this.m_hookForce, 1f, 0.5f); } if (this.m_inWater <= -10000f || this.m_inWater < base.transform.position.y + this.m_height) { this.m_body.useGravity = true; if (this.IsOutOfWater()) { return; } } this.m_body.useGravity = false; bool flag = false; Player playerNoiseRange = Player.GetPlayerNoiseRange(base.transform.position, 1f); if (playerNoiseRange) { if (Vector3.Distance(base.transform.position, playerNoiseRange.transform.position) > this.m_avoidRange / 2f) { Vector3 normalized = (base.transform.position - playerNoiseRange.transform.position).normalized; this.SwimDirection(normalized, true, true, fixedDeltaTime); return; } flag = true; if (this.m_swimTimer > 0.5f) { this.m_swimTimer = 0.5f; } } this.m_swimTimer -= fixedDeltaTime; if (this.m_swimTimer <= 0f) { this.RandomizeWaypoint(!flag); } if (this.m_haveWaypoint) { if (this.m_waypointFF) { this.m_waypoint = this.m_waypointFF.transform.position + Vector3.down; } if (Vector3.Distance(this.m_waypoint, base.transform.position) < 0.2f) { if (!this.m_waypointFF) { this.m_haveWaypoint = false; return; } if (Time.time - this.m_lastNibbleTime > 1f) { this.m_lastNibbleTime = Time.time; this.m_waypointFF.Nibble(this); } } Vector3 dir = Vector3.Normalize(this.m_waypoint - base.transform.position); this.SwimDirection(dir, flag, false, fixedDeltaTime); return; } this.Stop(fixedDeltaTime); }