目录调整,旧钓鱼逻辑全部注释
This commit is contained in:
@@ -4,156 +4,156 @@ namespace NBF
|
||||
{
|
||||
public static class PrefabCreator
|
||||
{
|
||||
#region 轮
|
||||
// #region 轮
|
||||
//
|
||||
// public static ReelAsset Create(this GameReels self, Transform parent, bool isPreview = false)
|
||||
// {
|
||||
// ReelAsset ret = null;
|
||||
// var prefab = self.Instantiate(parent);
|
||||
//
|
||||
// prefab.transform.localPosition = Vector3.zero;
|
||||
// prefab.transform.localRotation = Quaternion.identity;
|
||||
//
|
||||
// if (prefab.TryGetComponent<ReelAsset>(out var reel))
|
||||
// {
|
||||
// ret = reel;
|
||||
//
|
||||
// if (!isPreview)
|
||||
// {
|
||||
// prefab.AddComponent<FReel>();
|
||||
// // prefab.AddJoint();
|
||||
// // var dis = prefab.AddComponent<FWaterDisplacement>();
|
||||
// // dis.moveCharacteristic = FWaterDisplacement.MoveCharacteristic.Custom;
|
||||
// // dis.objectDisplacement = 2;
|
||||
// // dis.outwaterMass = 0.1f;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
|
||||
public static ReelAsset Create(this GameReels self, Transform parent, bool isPreview = false)
|
||||
{
|
||||
ReelAsset ret = null;
|
||||
var prefab = self.Instantiate(parent);
|
||||
|
||||
prefab.transform.localPosition = Vector3.zero;
|
||||
prefab.transform.localRotation = Quaternion.identity;
|
||||
|
||||
if (prefab.TryGetComponent<ReelAsset>(out var reel))
|
||||
{
|
||||
ret = reel;
|
||||
|
||||
if (!isPreview)
|
||||
{
|
||||
prefab.AddComponent<FReel>();
|
||||
// prefab.AddJoint();
|
||||
// var dis = prefab.AddComponent<FWaterDisplacement>();
|
||||
// dis.moveCharacteristic = FWaterDisplacement.MoveCharacteristic.Custom;
|
||||
// dis.objectDisplacement = 2;
|
||||
// dis.outwaterMass = 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 浮漂
|
||||
|
||||
public static BobberAsset Create(this GameFloats self, Transform parent, bool isPreview = false)
|
||||
{
|
||||
BobberAsset ret = null;
|
||||
var prefab = self.Instantiate(parent);
|
||||
|
||||
prefab.transform.localPosition = Vector3.zero;
|
||||
prefab.transform.localRotation = Quaternion.identity;
|
||||
|
||||
if (prefab.TryGetComponent<BobberAsset>(out var lure))
|
||||
{
|
||||
ret = lure;
|
||||
|
||||
if (!isPreview)
|
||||
{
|
||||
prefab.AddComponent<FFloat>();
|
||||
prefab.AddJoint();
|
||||
var dis = prefab.AddComponent<FWaterDisplacement>();
|
||||
dis.moveCharacteristic = FWaterDisplacement.MoveCharacteristic.Custom;
|
||||
dis.objectDisplacement = 2;
|
||||
dis.outwaterMass = 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 饵
|
||||
|
||||
public static LureAsset Create(this GameLures self, Transform parent, bool isPreview = false)
|
||||
{
|
||||
LureAsset ret = null;
|
||||
var prefab = self.Instantiate(parent);
|
||||
|
||||
|
||||
if (prefab.TryGetComponent<LureAsset>(out var lure))
|
||||
{
|
||||
ret = lure;
|
||||
|
||||
if (!isPreview)
|
||||
{
|
||||
prefab.AddComponent<FLure>();
|
||||
prefab.AddJoint();
|
||||
var rigidbody = prefab.GetComponent<Rigidbody>();
|
||||
rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
|
||||
rigidbody.linearDamping = 0.5f;
|
||||
var dis = prefab.AddComponent<FWaterDisplacement>();
|
||||
// dis.moveCharacteristic = FWaterDisplacement.MoveCharacteristic.Custom;
|
||||
// dis.objectDisplacement = 2;
|
||||
dis.outwaterMass = 0.5f;
|
||||
}
|
||||
|
||||
if (lure.hookPoints != null && lure.hookPoints.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < lure.hookPoints.Length; i++)
|
||||
{
|
||||
var hookPoint = lure.hookPoints[i];
|
||||
var hook = self.hook[0];
|
||||
var hookConfig = GameHooks.Get(hook);
|
||||
var hookAsset = hookConfig.Create(hookPoint, true);
|
||||
hookAsset.transform.localPosition = Vector3.zero;
|
||||
hookAsset.transform.localRotation = Quaternion.identity;
|
||||
var configurableJoint = hookAsset.GetComponent<ConfigurableJoint>();
|
||||
configurableJoint.connectedBody = prefab.GetComponent<Rigidbody>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static BaitAsset Create(this GameBaits self, Transform parent, bool isPreview = false)
|
||||
{
|
||||
var prefab = self.Instantiate(parent);
|
||||
BaitAsset ret = null;
|
||||
if (prefab.TryGetComponent<BaitAsset>(out var hook))
|
||||
{
|
||||
ret = hook;
|
||||
}
|
||||
|
||||
prefab.transform.localPosition = Vector3.zero;
|
||||
prefab.transform.localRotation = Quaternion.identity;
|
||||
if (!isPreview)
|
||||
{
|
||||
prefab.AddComponent<FBait>();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 钩
|
||||
|
||||
public static HookAsset Create(this GameHooks self, Transform parent, bool isPreview = false)
|
||||
{
|
||||
var prefab = self.Instantiate(parent);
|
||||
HookAsset ret = null;
|
||||
if (prefab.TryGetComponent<HookAsset>(out var hook))
|
||||
{
|
||||
ret = hook;
|
||||
}
|
||||
|
||||
prefab.transform.localPosition = Vector3.zero;
|
||||
prefab.transform.localRotation = Quaternion.identity;
|
||||
if (!isPreview)
|
||||
{
|
||||
prefab.AddComponent<FHook>();
|
||||
var d = prefab.AddComponent<FWaterDisplacement>();
|
||||
d.outwaterMass = 0.1f;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endregion
|
||||
// #region 浮漂
|
||||
//
|
||||
// public static BobberAsset Create(this GameFloats self, Transform parent, bool isPreview = false)
|
||||
// {
|
||||
// BobberAsset ret = null;
|
||||
// var prefab = self.Instantiate(parent);
|
||||
//
|
||||
// prefab.transform.localPosition = Vector3.zero;
|
||||
// prefab.transform.localRotation = Quaternion.identity;
|
||||
//
|
||||
// if (prefab.TryGetComponent<BobberAsset>(out var lure))
|
||||
// {
|
||||
// ret = lure;
|
||||
//
|
||||
// if (!isPreview)
|
||||
// {
|
||||
// prefab.AddComponent<FFloat>();
|
||||
// prefab.AddJoint();
|
||||
// var dis = prefab.AddComponent<FWaterDisplacement>();
|
||||
// dis.moveCharacteristic = FWaterDisplacement.MoveCharacteristic.Custom;
|
||||
// dis.objectDisplacement = 2;
|
||||
// dis.outwaterMass = 0.1f;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
//
|
||||
// #region 饵
|
||||
//
|
||||
// public static LureAsset Create(this GameLures self, Transform parent, bool isPreview = false)
|
||||
// {
|
||||
// LureAsset ret = null;
|
||||
// var prefab = self.Instantiate(parent);
|
||||
//
|
||||
//
|
||||
// if (prefab.TryGetComponent<LureAsset>(out var lure))
|
||||
// {
|
||||
// ret = lure;
|
||||
//
|
||||
// if (!isPreview)
|
||||
// {
|
||||
// prefab.AddComponent<FLure>();
|
||||
// prefab.AddJoint();
|
||||
// var rigidbody = prefab.GetComponent<Rigidbody>();
|
||||
// rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
|
||||
// rigidbody.linearDamping = 0.5f;
|
||||
// var dis = prefab.AddComponent<FWaterDisplacement>();
|
||||
// // dis.moveCharacteristic = FWaterDisplacement.MoveCharacteristic.Custom;
|
||||
// // dis.objectDisplacement = 2;
|
||||
// dis.outwaterMass = 0.5f;
|
||||
// }
|
||||
//
|
||||
// if (lure.hookPoints != null && lure.hookPoints.Length > 0)
|
||||
// {
|
||||
// for (int i = 0; i < lure.hookPoints.Length; i++)
|
||||
// {
|
||||
// var hookPoint = lure.hookPoints[i];
|
||||
// var hook = self.hook[0];
|
||||
// var hookConfig = GameHooks.Get(hook);
|
||||
// var hookAsset = hookConfig.Create(hookPoint, true);
|
||||
// hookAsset.transform.localPosition = Vector3.zero;
|
||||
// hookAsset.transform.localRotation = Quaternion.identity;
|
||||
// var configurableJoint = hookAsset.GetComponent<ConfigurableJoint>();
|
||||
// configurableJoint.connectedBody = prefab.GetComponent<Rigidbody>();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// public static BaitAsset Create(this GameBaits self, Transform parent, bool isPreview = false)
|
||||
// {
|
||||
// var prefab = self.Instantiate(parent);
|
||||
// BaitAsset ret = null;
|
||||
// if (prefab.TryGetComponent<BaitAsset>(out var hook))
|
||||
// {
|
||||
// ret = hook;
|
||||
// }
|
||||
//
|
||||
// prefab.transform.localPosition = Vector3.zero;
|
||||
// prefab.transform.localRotation = Quaternion.identity;
|
||||
// if (!isPreview)
|
||||
// {
|
||||
// prefab.AddComponent<FBait>();
|
||||
// }
|
||||
//
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
//
|
||||
// #region 钩
|
||||
//
|
||||
// public static HookAsset Create(this GameHooks self, Transform parent, bool isPreview = false)
|
||||
// {
|
||||
// var prefab = self.Instantiate(parent);
|
||||
// HookAsset ret = null;
|
||||
// if (prefab.TryGetComponent<HookAsset>(out var hook))
|
||||
// {
|
||||
// ret = hook;
|
||||
// }
|
||||
//
|
||||
// prefab.transform.localPosition = Vector3.zero;
|
||||
// prefab.transform.localRotation = Quaternion.identity;
|
||||
// if (!isPreview)
|
||||
// {
|
||||
// prefab.AddComponent<FHook>();
|
||||
// var d = prefab.AddComponent<FWaterDisplacement>();
|
||||
// d.outwaterMass = 0.1f;
|
||||
// }
|
||||
//
|
||||
// return ret;
|
||||
// }
|
||||
//
|
||||
// #endregion
|
||||
|
||||
#region 工具
|
||||
|
||||
|
||||
Reference in New Issue
Block a user