Files
MinFt/Client/Assets/Scripts/GampPlay/Fishing/Rod.cs
2026-04-27 12:07:32 +08:00

55 lines
1.3 KiB
C#

using asap.core;
using RootMotion.FinalIK;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UniRx;
public class Rod : MonoBehaviour
{
public GameObject rod;
public Transform Bait; // 鱼饵的位置
public Transform TopLine; // 钓鱼竿的顶部位置
public Transform EndLine;
public Transform Rod_Joint;
public List<Transform> LineList;
public Transform LineHole;
public LineRenderer fishingLineRenderer;
public CCDIK cCDIK;
public Transform LeftHandTargets;
public Transform RightHandTargets;
public Transform BodyTargets;
public TMP_Text lineLength;
System.IDisposable disposable;
private void OnEnable()
{
disposable = GContext.OnEvent<FishRotateEvent>().Subscribe(OnFishingRotate);
}
private void OnDisable()
{
disposable?.Dispose();
disposable = null;
}
void OnFishingRotate(FishRotateEvent fishRotateEvent)
{
OnFishingRotate(fishRotateEvent.state);
}
private void OnFishingRotate(int state)
{
switch (state)
{
case 3:
fishingLineRenderer.endWidth = 0.003f;
break;
case 4:
fishingLineRenderer.endWidth = fishingLineRenderer.startWidth;
break;
}
}
}