using System; using UFS2.Gameplay; using UnityEngine; public class FishCatchState : IState { private FishEntity entity; private LODGroup lod; public static event Action OnEnter; public static event Action OnExit; public FishCatchState(FishEntity entity) { this.entity = entity; } public void Enter() { lod = entity.GetComponentInChildren(); entity.Physics.Rbody.mass = 1f; entity.SetAnimatorFloat("speed", 0.3f); FishCatchState.OnEnter?.Invoke(); } public void Execute() { FFishingLine fishingLine = FScriptsHandler.Instance.m_PlayerMain.currentRod.fishingLine; FPlayer playerMain = FScriptsHandler.Instance.m_PlayerMain; fishingLine.currentLineHandler.EndLineRigidbody.transform.position = playerMain.FullBodyAvatar.LineJoinerFish.position; lod.ForceLOD(0); fishingLine.currentLineHandler.ObiLineOut = 2f; if (entity.Weight < 1f) { entity.rod.currentHook?.ShowRenderer(); entity.rod.currentLure?.ShowRenderer(); } else { entity.rod.currentHook?.HideRenderer(); entity.rod.currentLure?.HideRenderer(); } } public void Exit() { FishCatchState.OnExit?.Invoke(); entity.SetAnimatorFloat("speed", 0f); FRod fRod = entity.rod; if (fRod == null) { fRod = FScriptsHandler.Instance.m_PlayerMain.currentRod; } fRod?.currentHook?.ShowRenderer(); fRod?.currentLure?.ShowRenderer(); } }