新增脚本
This commit is contained in:
@@ -35,6 +35,9 @@ namespace NBF
|
||||
public LookAtIK LookIk;
|
||||
|
||||
|
||||
public Transform RodRoot;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
LookIk = GetComponent<LookAtIK>();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using RootMotion.FinalIK;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
@@ -50,12 +51,22 @@ namespace NBF
|
||||
/// </summary>
|
||||
public Transform lineConnector;
|
||||
|
||||
private void Start()
|
||||
public CCDIK CCDIK;
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
CCDIK = GetComponent<CCDIK>();
|
||||
CCDIK.enabled = false;
|
||||
if (!lineConnector && joints.Length > 0)
|
||||
{
|
||||
lineConnector = joints[^1];
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
using NBC;
|
||||
using NBC.Asset;
|
||||
using NBF.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
@@ -17,7 +19,44 @@ namespace NBF
|
||||
|
||||
public static string GetModelPath(this ItemConfig config)
|
||||
{
|
||||
return "gfx/" + config.Model;
|
||||
return $"Assets/ResRaw/gfx/{config.Model}.prefab";
|
||||
}
|
||||
|
||||
public static GameObject GetModelPrefab(this ItemConfig config)
|
||||
{
|
||||
return Assets.Load<GameObject>(config.GetModelPath());
|
||||
}
|
||||
|
||||
public static GameObject Instantiate(this ItemConfig config, Transform parent, Vector3 position,
|
||||
Quaternion rotation)
|
||||
{
|
||||
return Object.Instantiate(config.GetModelPrefab(), position, rotation, parent);
|
||||
}
|
||||
|
||||
|
||||
public static T InstantiateAndComponent<T>(this ItemConfig config, Transform parent, Vector3 position,
|
||||
Quaternion rotation) where T : MonoBehaviour
|
||||
{
|
||||
var obj = config.Instantiate(parent, position, rotation);
|
||||
var com = obj.GetComponent<T>();
|
||||
if (com == null)
|
||||
{
|
||||
com = obj.AddComponent<T>();
|
||||
}
|
||||
|
||||
return com;
|
||||
}
|
||||
|
||||
public static T InstantiateAndComponent<T>(this ItemConfig config) where T : MonoBehaviour
|
||||
{
|
||||
var obj = Object.Instantiate(config.GetModelPrefab());
|
||||
var com = obj.GetComponent<T>();
|
||||
if (com == null)
|
||||
{
|
||||
com = obj.AddComponent<T>();
|
||||
}
|
||||
|
||||
return com;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,8 @@ namespace NBF
|
||||
|
||||
|
||||
_bindConfigs.Add(rodTele.SubType, rodTele);
|
||||
_bindConfigs.Add(rodBolo.SubType, rodBolo);
|
||||
_bindConfigs.Add(rodSpine.SubType, rodSpine);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -9,7 +9,8 @@ namespace NBF.Utils
|
||||
{
|
||||
public static string GetFullModelPath(this ItemConfig config)
|
||||
{
|
||||
return Path.Combine("gfx", config.Model);
|
||||
//Assets/ResRaw/gfx/hooks/alliance/c_hook_20789_20794/c_hook_20789.prefab
|
||||
return $"Assets/ResRaw/gfx/{config.Model}.prefab"; //Path.Combine("Assets/ResRaw/gfx", config.Model);
|
||||
}
|
||||
|
||||
public static ItemType GetItemType(this uint id)
|
||||
|
||||
Reference in New Issue
Block a user