代码提交

This commit is contained in:
2026-04-12 23:52:07 +08:00
parent 95700b71c1
commit fbe33f9f3a
16 changed files with 1802 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
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.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;
}
}
}