拿起放下物品
This commit is contained in:
@@ -107,8 +107,16 @@ namespace Obi
|
||||
}
|
||||
#if ENABLE_UNITY_COLLECTIONS_CHECKS
|
||||
// dispose of atomic safety handle:
|
||||
AtomicSafetyHandle.CheckDeallocateAndThrow(m_SafetyHandle);
|
||||
AtomicSafetyHandle.Release(m_SafetyHandle);
|
||||
try
|
||||
{
|
||||
AtomicSafetyHandle.CheckDeallocateAndThrow(m_SafetyHandle);
|
||||
AtomicSafetyHandle.Release(m_SafetyHandle);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ namespace NBF
|
||||
else if (action == InputDef.Player.ToBag)
|
||||
{
|
||||
//取消手持物品
|
||||
Log.Info($"取消手持物品");
|
||||
Game.Instance.StartCoroutine(UnUseItem());
|
||||
}
|
||||
else if (action.StartsWith(InputDef.Player.QuickStarts))
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using NBF.Fishing2;
|
||||
using NBF.Utils;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
@@ -28,6 +29,9 @@ namespace NBF
|
||||
public readonly List<FRod> Tackles = new List<FRod>();
|
||||
public FRod Rod { get; private set; }
|
||||
|
||||
public event Action<FHandItem> OnFishingSetEquiped;
|
||||
public event Action OnFishingSetUnequip;
|
||||
|
||||
protected override void OnAwake()
|
||||
{
|
||||
Character = gameObject.GetComponent<CharacterMovement>();
|
||||
@@ -81,9 +85,24 @@ namespace NBF
|
||||
}
|
||||
|
||||
Rod =
|
||||
item.Config.InstantiateAndComponent<FRod>(SceneSettings.Instance.GearNode, Vector3.zero, Quaternion.identity);
|
||||
item.Config.InstantiateAndComponent<FRod>(SceneSettings.Instance.GearNode, Vector3.zero,
|
||||
Quaternion.identity);
|
||||
yield return Rod.InitRod(this, item);
|
||||
Tackles.Add(Rod);
|
||||
OnFishingSetEquiped?.Invoke(Rod);
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator UnUseItem()
|
||||
{
|
||||
OnFishingSetUnequip?.Invoke();
|
||||
if (Rod != null)
|
||||
{
|
||||
yield return new WaitForSeconds(0.35f);
|
||||
yield return Rod.Destroy();
|
||||
Destroy(Rod.gameObject);
|
||||
Tackles.Remove(Rod);
|
||||
Rod = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,24 +58,18 @@ namespace NBF
|
||||
_Animator.keepAnimatorStateOnDisable = true;
|
||||
_IK = GetComponent<PlayerIK>();
|
||||
_isInit = true;
|
||||
|
||||
Player.OnFishingSetEquiped += OnFishingSetEquiped_OnRaised;
|
||||
Player.OnFishingSetUnequip += OnFishingSetUnequip;
|
||||
Player.Data.OnStateChange += PlayerFSMState_OnValueChanged;
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
Player.OnFishingSetEquiped -= OnFishingSetEquiped_OnRaised;
|
||||
Player.OnFishingSetUnequip -= OnFishingSetUnequip;
|
||||
Player.Data.OnStateChange += PlayerFSMState_OnValueChanged;
|
||||
}
|
||||
|
||||
// private void OnEnable()
|
||||
// {
|
||||
// playerFSMState.OnValueChanged += PlayerFSMState_OnValueChanged;
|
||||
// }
|
||||
//
|
||||
// private void OnDisable()
|
||||
// {
|
||||
// playerFSMState.OnValueChanged -= PlayerFSMState_OnValueChanged;
|
||||
// }
|
||||
|
||||
private void OnFishingSetUnequip()
|
||||
{
|
||||
@@ -99,12 +93,18 @@ namespace NBF
|
||||
// }
|
||||
}
|
||||
|
||||
// private void OnFishingSetEquiped_OnRaised(FishingSetController set)
|
||||
// {
|
||||
// _isTorsoLayerEnabled = true;
|
||||
// var reel = Player.Rod.Reel;
|
||||
// // _IK.SetBipedLeftHandIK(enabled: false, reel.FingersIKAnchor);
|
||||
// }
|
||||
private void OnFishingSetEquiped_OnRaised(FHandItem item)
|
||||
{
|
||||
if (item is FRod rod)
|
||||
{
|
||||
_isTorsoLayerEnabled = true;
|
||||
// var reel = Player.Rod.Reel;
|
||||
// _IK.SetBipedLeftHandIK(enabled: false, reel.FingersIKAnchor);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayAnimation(string state, string layer)
|
||||
{
|
||||
@@ -233,40 +233,5 @@ namespace NBF
|
||||
SetLayerWeight(Torso,
|
||||
Mathf.MoveTowards(layerWeight, _isTorsoLayerEnabled ? 1f : 0f, Time.deltaTime * 3f));
|
||||
}
|
||||
|
||||
|
||||
// private void LateUpdate()
|
||||
// {
|
||||
// if (!_isInit) return;
|
||||
// UpdateAnimator();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private void UpdateAnimator()
|
||||
// {
|
||||
// Animator.SetBool(OnGround, Player.Data.IsGrounded);
|
||||
// float value3 = Mathf.Lerp(Animator.GetFloat(Forward), Player.Data.Speed / 5f, Time.deltaTime * 20f);
|
||||
// Animator.SetFloat(Forward, value3);
|
||||
//
|
||||
// // 平滑处理
|
||||
// // float smoothedTurn = Mathf.SmoothDamp(Animator.GetFloat(Turn),
|
||||
// // MapUnit.RotationSpeed,
|
||||
// // ref turnSmoothVelocity,
|
||||
// // smoothingTime
|
||||
// // );
|
||||
//
|
||||
// float smoothedTurn = Mathf.Lerp(Animator.GetFloat(Turn), Player.Data.RotationSpeed, Time.deltaTime * 10f);
|
||||
// Animator.SetFloat(Turn, smoothedTurn);
|
||||
//
|
||||
//
|
||||
// float layerWeight = Animator.GetLayerWeight(Animator.GetLayerIndex(Torso));
|
||||
// SetLayerWeight(Torso,
|
||||
// Mathf.MoveTowards(layerWeight, _isTorsoLayerEnabled ? 1f : 0f, Time.deltaTime * 3f));
|
||||
// }
|
||||
//
|
||||
// public void SetLayerWeight(string layer, float weight)
|
||||
// {
|
||||
// Animator.SetLayerWeight(Animator.GetLayerIndex(layer), weight);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ namespace NBF
|
||||
/// 鱼线处理器
|
||||
/// </summary>
|
||||
public FLineHandler lineHandler;
|
||||
|
||||
|
||||
public Transform GearRoot;
|
||||
|
||||
// public FWaterDisplacement LureHookWaterDisplacement;
|
||||
@@ -60,6 +60,11 @@ namespace NBF
|
||||
|
||||
public IEnumerator Destroy()
|
||||
{
|
||||
if (GearRoot != null)
|
||||
{
|
||||
Object.Destroy(GearRoot.gameObject);
|
||||
}
|
||||
|
||||
yield return 1;
|
||||
}
|
||||
|
||||
@@ -134,8 +139,7 @@ namespace NBF
|
||||
lineItemInfo = child;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
yield return 1;
|
||||
if (Reel)
|
||||
@@ -151,18 +155,18 @@ namespace NBF
|
||||
{
|
||||
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);
|
||||
@@ -182,7 +186,6 @@ namespace NBF
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void CreateFishingHandler()
|
||||
{
|
||||
if (lineHandler == null)
|
||||
@@ -201,7 +204,6 @@ namespace NBF
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void CreateObiFishingLine(int currentLineTypeIndex)
|
||||
{
|
||||
// if ((bool)Owner.Gears.Reel && !currentLineHandler)
|
||||
@@ -211,10 +213,10 @@ namespace NBF
|
||||
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;
|
||||
@@ -226,7 +228,7 @@ namespace NBF
|
||||
SceneSettings.Instance.obiFixedUpdater.solvers.Add(obiSolver);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetRing(RodRingAsset ringAsset)
|
||||
{
|
||||
if (Asset.rings == null || Asset.rings.Length < 1) return;
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARigidbody_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F03ef825315384b1cab81c4b53eb03d922ac00_003Fb7_003F46515be2_003FRigidbody_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASceneManager_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F021f30a9a92b48ce98ae6b39956dd76a1df600_003F71_003F10954773_003FSceneManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AScene_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1acad9deef3549c4b9617dfa169c66599f7e00_003Fce_003F313afe7b_003FScene_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASetupCoroutine_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4c8c45fec274213bfac03ee0e9a3d621f5a00_003Fa8_003F676cff19_003FSetupCoroutine_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AShader_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4c8c45fec274213bfac03ee0e9a3d621f5a00_003Fd9_003F9fb4403c_003FShader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AShadowCastingMode_002Ecs_002Fl_003AC_0021_003FUsers_003FFIREBAT_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb4c8c45fec274213bfac03ee0e9a3d621f5a00_003Fd9_003F3be02aeb_003FShadowCastingMode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASphereCollider_002Ecs_002Fl_003AC_0021_003FUsers_003F60527_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F03ef825315384b1cab81c4b53eb03d922ac00_003F31_003F871dbbe1_003FSphereCollider_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
|
||||
Reference in New Issue
Block a user