升级obi
This commit is contained in:
@@ -28,13 +28,13 @@ namespace NBF
|
||||
public FBait Bait;
|
||||
public FLure Lure;
|
||||
public FWeight Weight;
|
||||
// public FLine Line;
|
||||
public FLine Line;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 鱼线处理器
|
||||
/// </summary>
|
||||
public FLineHandler lineHandler;
|
||||
// /// <summary>
|
||||
// /// 鱼线处理器
|
||||
// /// </summary>
|
||||
// public FLineHandler lineHandler;
|
||||
|
||||
public Transform GearRoot;
|
||||
|
||||
@@ -46,7 +46,12 @@ namespace NBF
|
||||
/// <summary>
|
||||
/// 线长度
|
||||
/// </summary>
|
||||
public float lineLength;
|
||||
public float lineLength = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 浮漂线长度
|
||||
/// </summary>
|
||||
public float floatLength = 0.5f;
|
||||
|
||||
public float currentLineTension;
|
||||
public float linelenghtDiferent;
|
||||
@@ -58,6 +63,11 @@ namespace NBF
|
||||
Asset = GetComponent<RodAsset>();
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
Test();
|
||||
}
|
||||
|
||||
public IEnumerator Destroy()
|
||||
{
|
||||
if (GearRoot != null)
|
||||
@@ -92,7 +102,6 @@ namespace NBF
|
||||
|
||||
ItemInfo lineItemInfo = null;
|
||||
|
||||
CreateFishingHandler();
|
||||
|
||||
// children.Sort();
|
||||
foreach (var child in children)
|
||||
@@ -140,7 +149,8 @@ namespace NBF
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
yield return 1;
|
||||
CreateFishingHandler();
|
||||
yield return 1;
|
||||
if (Reel)
|
||||
{
|
||||
@@ -177,8 +187,8 @@ namespace NBF
|
||||
Weight.Init(Player, this);
|
||||
}
|
||||
|
||||
yield return 2; //等待1帧
|
||||
|
||||
yield return 1; //等待1帧
|
||||
|
||||
transform.SetParent(Player.ModelAsset.RodRoot);
|
||||
transform.localPosition = Vector3.zero;
|
||||
transform.rotation = Player.ModelAsset.RodRoot.rotation;
|
||||
@@ -189,7 +199,7 @@ namespace NBF
|
||||
|
||||
public void CreateFishingHandler()
|
||||
{
|
||||
if (lineHandler == null)
|
||||
if (Line == null)
|
||||
{
|
||||
Debug.LogError("创建钓组=====");
|
||||
var rodType = (ItemSubType)ItemInfo.Config.Type;
|
||||
@@ -208,25 +218,37 @@ namespace NBF
|
||||
public void CreateObiFishingLine(int currentLineTypeIndex)
|
||||
{
|
||||
// if ((bool)Owner.Gears.Reel && !currentLineHandler)
|
||||
if (!lineHandler)
|
||||
if (!Line)
|
||||
{
|
||||
var indexNames = new[] { "FFishingLine_0", "FFishingLine_1" };
|
||||
//Assets/ResRaw/Prefabs/Line/LineSolver.prefab
|
||||
var lineSolverPrefab = Assets.Load<GameObject>("Assets/ResRaw/Prefabs/Line/LineSolver.prefab");
|
||||
var solver = Instantiate(lineSolverPrefab, GearRoot);
|
||||
solver.transform.position = Asset.lineConnector.position;
|
||||
solver.transform.rotation = Asset.lineConnector.rotation;
|
||||
// var indexNames = new[] { "FFishingLine_0", "FFishingLine_1" };
|
||||
var indexNames = new[] { "fishing line float set", "fishing line spinning" };
|
||||
var path =
|
||||
$"Assets/ResRaw/Prefabs/{indexNames[currentLineTypeIndex]}.prefab"; //$"GameItemsPrefabs/Lines/{indexNames[currentLineTypeIndex]}";
|
||||
$"Assets/ResRaw/Prefabs/Line/{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);
|
||||
GameObject obj = Instantiate(prefab, solver.transform);
|
||||
obj.transform.localPosition = Vector3.zero;
|
||||
obj.transform.localScale = Vector3.one;
|
||||
obj.transform.rotation = Quaternion.identity;
|
||||
|
||||
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;
|
||||
// lineHandler.startParticleAttachment.target = Asset.lineConnector;
|
||||
var obiSolver = lineHandler.GetComponent<ObiSolver>();
|
||||
SceneSettings.Instance.obiFixedUpdater.solvers.Add(obiSolver);
|
||||
Line = obj.GetComponent<FLine>();
|
||||
Line.transform.position = Asset.lineConnector.position;
|
||||
Line.Init(this.Player, this);
|
||||
|
||||
// lineHandler = obj.GetComponent<FLineHandler>();
|
||||
// // lineHandler.transform.SetParent(toRodConnector.transform);
|
||||
// lineHandler.transform.position = Asset.lineConnector.position;
|
||||
// lineHandler.LineConnector_0.target = Asset.lineConnector; //.GetComponent<Rigidbody>();
|
||||
// lineHandler.Rod = this;
|
||||
// // lineHandler.startParticleAttachment.target = Asset.lineConnector;
|
||||
var obiSolver = solver.GetComponent<ObiSolver>();
|
||||
// SceneSettings.Instance.obiFixedUpdater.solvers.Add(obiSolver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,5 +290,12 @@ namespace NBF
|
||||
|
||||
rings = list.ToArray();
|
||||
}
|
||||
|
||||
private void Test()
|
||||
{
|
||||
// var root = Player.ModelAsset.RodRoot;
|
||||
// if (!root) return;
|
||||
// transform.SetPositionAndRotation(root.position, root.rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user