修改动画回调事件
This commit is contained in:
@@ -12,17 +12,10 @@ namespace NBF
|
||||
{
|
||||
public class FRod : FHandItem
|
||||
{
|
||||
private float _tension;
|
||||
|
||||
public PlayerItem PlayerItem;
|
||||
|
||||
public override int ConfigId => PlayerItem?.ConfigID ?? 0;
|
||||
|
||||
/// <summary>
|
||||
/// 可用的
|
||||
/// </summary>
|
||||
public bool Usable { get; private set; }
|
||||
|
||||
public RodAsset Asset;
|
||||
|
||||
public FReel Reel;
|
||||
@@ -41,29 +34,6 @@ namespace NBF
|
||||
[HideInInspector] public FFish currentFish;
|
||||
public RodRingNode[] rings;
|
||||
|
||||
/// <summary>
|
||||
/// 线长度
|
||||
/// </summary>
|
||||
public float lineLength = 1.5f;
|
||||
|
||||
/// <summary>
|
||||
/// 浮漂线长度
|
||||
/// </summary>
|
||||
public float floatLength = 0.5f;
|
||||
|
||||
public float Tension
|
||||
{
|
||||
get => _tension;
|
||||
private set
|
||||
{
|
||||
if (!Mathf.Approximately(_tension, value))
|
||||
{
|
||||
_tension = value;
|
||||
// OnTensionChanged?.Invoke(_tension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -72,42 +42,43 @@ namespace NBF
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Alpha0))
|
||||
{
|
||||
SetLineLength(lineLength);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.Plus) || Input.GetKeyDown(KeyCode.Equals))
|
||||
{
|
||||
lineLength += 0.1f;
|
||||
SetLineLength(lineLength);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.Minus))
|
||||
{
|
||||
lineLength -= 0.1f;
|
||||
SetLineLength(lineLength);
|
||||
}
|
||||
// if (Input.GetKeyDown(KeyCode.Alpha0))
|
||||
// {
|
||||
// SetLineLength(lineLength);
|
||||
// }
|
||||
// else if (Input.GetKeyDown(KeyCode.Plus) || Input.GetKeyDown(KeyCode.Equals))
|
||||
// {
|
||||
// lineLength += 0.1f;
|
||||
// SetLineLength(lineLength);
|
||||
// }
|
||||
// else if (Input.GetKeyDown(KeyCode.Minus))
|
||||
// {
|
||||
// lineLength -= 0.1f;
|
||||
// SetLineLength(lineLength);
|
||||
// }
|
||||
// SetLineLength();
|
||||
}
|
||||
|
||||
public void SetLineLength(float lineLength, bool stretchRope = true)
|
||||
public void SetLineLength()
|
||||
{
|
||||
if (!Line) return;
|
||||
if (Line.LineType == LineType.Spinning)
|
||||
{
|
||||
//没有浮漂类型
|
||||
Line.Lure.SetJointDistance(lineLength);
|
||||
if (stretchRope)
|
||||
Line.Lure.SetJointDistance(PlayerItem.LineLength);
|
||||
if (PlayerItem.StretchRope)
|
||||
{
|
||||
Line.SetTargetLength(Tension > 0f ? 0f : lineLength);
|
||||
Line.SetTargetLength(PlayerItem.Tension > 0f ? 0f : PlayerItem.LineLength);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//有浮漂
|
||||
Line.Lure.SetJointDistance(floatLength);
|
||||
Line.Bobber.SetJointDistance(lineLength - floatLength);
|
||||
if (stretchRope)
|
||||
Line.Lure.SetJointDistance(PlayerItem.FloatLength);
|
||||
Line.Bobber.SetJointDistance(PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
if (PlayerItem.StretchRope)
|
||||
{
|
||||
Line.SetTargetLength(Tension > 0f ? 0f : lineLength - floatLength);
|
||||
Line.SetTargetLength(PlayerItem.Tension > 0f ? 0f : PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,6 +175,7 @@ namespace NBF
|
||||
}
|
||||
|
||||
await FTask.WaitFrame(playerView.Scene); //等待1帧
|
||||
SetLineLength();
|
||||
if (Reel)
|
||||
{
|
||||
Reel.reelingDrag = 0.699f;
|
||||
@@ -243,8 +215,6 @@ namespace NBF
|
||||
transform.SetParent(playerViewUnity.ModelAsset.RodRoot);
|
||||
transform.localPosition = Vector3.zero;
|
||||
transform.rotation = playerViewUnity.ModelAsset.RodRoot.rotation;
|
||||
|
||||
Usable = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user