修改鱼线节点逻辑

This commit is contained in:
2026-04-12 18:37:24 +08:00
parent d451af0c8a
commit 8fbb21a66c
24 changed files with 4447 additions and 1 deletions

View File

@@ -0,0 +1,46 @@
using UnityEngine;
namespace NBF
{
/// <summary>
/// 默认物理组件
/// </summary>
public class FishingDefaultPhysicsFeature : FishingLineNodeMotionFeature
{
[Header("Physics")] [SerializeField] private bool useGravity = true;
protected override int DefaultPriority => 0;
public override bool IsSupportedNode(FishingLineNode node)
{
return node != null
&& !node.IsRuntimeVirtualNode
&& node.Type != FishingLineNode.NodeType.Start;
}
public override bool CanControl()
{
return Node != null && Node.Body != null && IsSupportedNode(Node);
}
public override void OnMotionActivated()
{
ApplyPhysicsState();
}
public override void TickMotion(float deltaTime)
{
ApplyPhysicsState();
}
private void ApplyPhysicsState()
{
if (Node == null || Node.Body == null || !IsSupportedNode(Node))
{
return;
}
Node.Body.useGravity = useGravity;
}
}
}