sava
This commit is contained in:
@@ -28,9 +28,14 @@ namespace NBF
|
||||
public FBait Bait;
|
||||
public FLure Lure;
|
||||
public FWeight Weight;
|
||||
public FLine Line;
|
||||
// public FLine Line;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 鱼线处理器
|
||||
/// </summary>
|
||||
public FLineHandler lineHandler;
|
||||
|
||||
public Transform GearRoot;
|
||||
|
||||
// public FWaterDisplacement LureHookWaterDisplacement;
|
||||
@@ -81,7 +86,7 @@ namespace NBF
|
||||
|
||||
ItemInfo lineItemInfo = null;
|
||||
|
||||
// CreateFishingHandler();
|
||||
CreateFishingHandler();
|
||||
|
||||
// children.Sort();
|
||||
foreach (var child in children)
|
||||
@@ -141,40 +146,26 @@ namespace NBF
|
||||
Reel.Init(player, this);
|
||||
}
|
||||
|
||||
// if (Bobber)
|
||||
// {
|
||||
// Bobber.Init(Player, this);
|
||||
// Bobber.transform.position = lineHandler.LineConnector_1.transform.position;
|
||||
// Bobber.gameObject.GetComponent<ConfigurableJoint>().connectedBody =
|
||||
// lineHandler.LineConnector_1.GetComponent<Rigidbody>();
|
||||
// }
|
||||
//
|
||||
// if (Hook)
|
||||
// {
|
||||
// Hook.Init(Player, this);
|
||||
// Hook.transform.position = lineHandler.LineConnector_2.transform.position;
|
||||
// Hook.transform.rotation = lineHandler.LineConnector_2.transform.rotation; // 确保旋转也同步
|
||||
// var target = lineHandler.LineConnector_2.GetComponent<Rigidbody>();
|
||||
// var joint = Hook.gameObject.GetComponent<ConfigurableJoint>();
|
||||
// joint.connectedBody = target;
|
||||
// // LureHookWaterDisplacement = Hook.GetComponent<FWaterDisplacement>();
|
||||
// }
|
||||
//
|
||||
// if (Bait)
|
||||
// {
|
||||
// Bait.Init(Player, this);
|
||||
// Bait.transform.position = Hook.hookAsset.baitConnector.position;
|
||||
// Bait.transform.SetParent(Hook.hookAsset.baitConnector);
|
||||
// }
|
||||
//
|
||||
// if (Lure)
|
||||
// {
|
||||
// Lure.Init(Player, this);
|
||||
// Lure.transform.position = lineHandler.LineConnector_1.transform.position;
|
||||
// Lure.gameObject.GetComponent<ConfigurableJoint>().connectedBody =
|
||||
// lineHandler.LineConnector_1.GetComponent<Rigidbody>();
|
||||
// // LureHookWaterDisplacement = Lure.GetComponent<FWaterDisplacement>();
|
||||
// }
|
||||
if (Bobber)
|
||||
{
|
||||
Bobber.Init(Player, this);
|
||||
}
|
||||
|
||||
if (Hook)
|
||||
{
|
||||
Hook.Init(Player, this);
|
||||
// LureHookWaterDisplacement = Hook.GetComponent<FWaterDisplacement>();
|
||||
}
|
||||
|
||||
if (Bait)
|
||||
{
|
||||
Bait.Init(Player, this);
|
||||
}
|
||||
|
||||
if (Lure)
|
||||
{
|
||||
Lure.Init(Player, this);
|
||||
}
|
||||
|
||||
if (Weight)
|
||||
{
|
||||
@@ -190,6 +181,50 @@ namespace NBF
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void CreateFishingHandler()
|
||||
{
|
||||
if (lineHandler == null)
|
||||
{
|
||||
Debug.LogError("创建钓组=====");
|
||||
var rodType = (ItemSubType)ItemInfo.Config.Type;
|
||||
if (rodType == ItemSubType.RodTele)
|
||||
{
|
||||
CreateObiFishingLine(0);
|
||||
}
|
||||
else if (rodType == ItemSubType.RodSpine || rodType == ItemSubType.RodBolo)
|
||||
{
|
||||
CreateObiFishingLine(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void CreateObiFishingLine(int currentLineTypeIndex)
|
||||
{
|
||||
// if ((bool)Owner.Gears.Reel && !currentLineHandler)
|
||||
if (!lineHandler)
|
||||
{
|
||||
var indexNames = new[] { "FFishingLine_0", "FFishingLine_1" };
|
||||
var path =
|
||||
$"Assets/ResRaw/Prefabs/{indexNames[currentLineTypeIndex]}.prefab"; //$"GameItemsPrefabs/Lines/{indexNames[currentLineTypeIndex]}";
|
||||
var prefab = Assets.Load<GameObject>(path);
|
||||
|
||||
// var toRodConnector = rodAsset.lineConnector.GetComponent<Rigidbody>();
|
||||
GameObject obj = Instantiate(prefab, GearRoot.position, Quaternion.identity, GearRoot);
|
||||
|
||||
lineHandler = obj.GetComponent<FLineHandler>();
|
||||
// lineHandler.transform.SetParent(toRodConnector.transform);
|
||||
lineHandler.transform.position = Asset.lineConnector.position;
|
||||
lineHandler.LineConnector_0.target = Asset.lineConnector; //.GetComponent<Rigidbody>();
|
||||
// lineHandler.toRodConnector.target = rodAsset.lineConnector;
|
||||
lineHandler.Rod = this;
|
||||
// var obiSolver = lineHandler.GetComponent<ObiSolver>();
|
||||
// SceneSettings.Instance.obiFixedUpdater.solvers.Add(obiSolver);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetRing(RodRingAsset ringAsset)
|
||||
{
|
||||
if (Asset.rings == null || Asset.rings.Length < 1) return;
|
||||
|
||||
Reference in New Issue
Block a user