修改鱼线相关逻辑
This commit is contained in:
@@ -25,7 +25,7 @@ namespace NBF
|
||||
public FBait Bait;
|
||||
public FLure Lure;
|
||||
public FWeight Weight;
|
||||
public FLine Line;
|
||||
public FishingLineSolver Line;
|
||||
|
||||
|
||||
public Transform GearRoot;
|
||||
@@ -72,24 +72,29 @@ namespace NBF
|
||||
if (Line.LineType == LineType.Spinning)
|
||||
{
|
||||
//没有浮漂类型
|
||||
Line.Lure.SetJointDistance(PlayerItem.LineLength);
|
||||
if (PlayerItem.StretchRope)
|
||||
{
|
||||
// Line.SetTargetLength(PlayerItem.Tension > 0f ? 0f : PlayerItem.LineLength);
|
||||
Line.SetTargetLength(PlayerItem.LineLength);
|
||||
}
|
||||
// Line.Lure.SetJointDistance(PlayerItem.LineLength);
|
||||
// if (PlayerItem.StretchRope)
|
||||
// {
|
||||
// // Line.SetTargetLength(PlayerItem.Tension > 0f ? 0f : PlayerItem.LineLength);
|
||||
// Line.SetTargetLength(PlayerItem.LineLength);
|
||||
// }
|
||||
|
||||
Line.SetLenght(PlayerItem.LineLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
//有浮漂
|
||||
Line.Lure.SetJointDistance(PlayerItem.FloatLength);
|
||||
Line.Bobber.SetJointDistance(PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
if (PlayerItem.StretchRope)
|
||||
{
|
||||
// Line.SetTargetLength(PlayerItem.Tension > 0f ? 0f : PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
Line.SetTargetLength(PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
Line.SetLureLength(PlayerItem.FloatLength);
|
||||
}
|
||||
// Line.Lure.SetJointDistance(PlayerItem.FloatLength);
|
||||
// Line.Bobber.SetJointDistance(PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
// if (PlayerItem.StretchRope)
|
||||
// {
|
||||
// // Line.SetTargetLength(PlayerItem.Tension > 0f ? 0f : PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
// Line.SetTargetLength(PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
// Line.SetLureLength(PlayerItem.FloatLength);
|
||||
// }
|
||||
|
||||
Line.SetLenght(PlayerItem.LineLength - PlayerItem.FloatLength);
|
||||
Line.SetLenght(PlayerItem.FloatLength, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +256,7 @@ namespace NBF
|
||||
var solver = Instantiate(lineSolverPrefab, GearRoot);
|
||||
solver.transform.position = Asset.lineConnector.position;
|
||||
solver.transform.rotation = Asset.lineConnector.rotation;
|
||||
var indexNames = new[] { "fishing line float set", "fishing line spinning" };
|
||||
var indexNames = new[] { "FishingLine1", "FishingLine1" };
|
||||
var path =
|
||||
$"Assets/ResRaw/Prefabs/Line/{indexNames[currentLineTypeIndex]}.prefab";
|
||||
var prefab = Assets.Load<GameObject>(path);
|
||||
@@ -261,7 +266,7 @@ namespace NBF
|
||||
obj.transform.localScale = Vector3.one;
|
||||
obj.transform.rotation = Quaternion.identity;
|
||||
|
||||
Line = obj.GetComponent<FLine>();
|
||||
Line = obj.GetComponent<FishingLineSolver>();
|
||||
Line.transform.position = Asset.lineConnector.position;
|
||||
Line.Init(this);
|
||||
}
|
||||
@@ -339,11 +344,13 @@ namespace NBF
|
||||
var state = PlayerItem.Owner.State;
|
||||
|
||||
|
||||
Vector3 vector = Line.Lure.transform.position;
|
||||
var endNode = Line.GetEndNode();
|
||||
|
||||
Vector3 vector = endNode.transform.position;
|
||||
|
||||
// 当前物体的朝向与指向 Lure 的方向之间的夹角,在 0(完全对齐)到 1(完全相反)之间的一个比例值
|
||||
float headingAlignment = Vector3.Angle(base.transform.forward,
|
||||
(Line.Lure.transform.position - transform.position).normalized) / 180f;
|
||||
(endNode.transform.position - transform.position).normalized) / 180f;
|
||||
// 经过朝向调制后的有效张力
|
||||
var effectiveTension = Mathf.Clamp(CurrentTension01 * headingAlignment, 0f, 1f);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user