diff --git a/Assets/ResRaw/Prefabs/Line/LineHand1.prefab b/Assets/ResRaw/Prefabs/Line/LineHand1.prefab index 5fd1516d6..f1dffb462 100644 --- a/Assets/ResRaw/Prefabs/Line/LineHand1.prefab +++ b/Assets/ResRaw/Prefabs/Line/LineHand1.prefab @@ -214,7 +214,7 @@ GameObject: - component: {fileID: 4026445325167852} - component: {fileID: 54679398375713381} - component: {fileID: 135844594273256032} - - component: {fileID: 4840064090904105689} + - component: {fileID: 2951454344396477079} - component: {fileID: 2305106969988397276} - component: {fileID: 6377942246174119720} m_Layer: 7 @@ -287,8 +287,8 @@ SphereCollider: serializedVersion: 3 m_Radius: 0.003 m_Center: {x: 0, y: -0.0015, z: 0} ---- !u!145 &4840064090904105689 -SpringJoint: +--- !u!153 &2951454344396477079 +ConfigurableJoint: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -298,16 +298,94 @@ SpringJoint: m_ConnectedBody: {fileID: 54298866000586118} m_ConnectedArticulationBody: {fileID: 0} m_Anchor: {x: 0, y: 0, z: 0} + m_Axis: {x: 1, y: 0, z: 0} m_AutoConfigureConnectedAnchor: 1 m_ConnectedAnchor: {x: 0, y: 0, z: 0} - m_Spring: 10000 - m_Damper: 1 - m_MinDistance: 0 - m_MaxDistance: 0 - m_Tolerance: 0.025 + m_SecondaryAxis: {x: 0, y: 1, z: 0} + m_XMotion: 1 + m_YMotion: 1 + m_ZMotion: 1 + m_AngularXMotion: 2 + m_AngularYMotion: 2 + m_AngularZMotion: 2 + m_LinearLimitSpring: + spring: 0 + damper: 0 + m_LinearLimit: + limit: 0.5 + bounciness: 0 + contactDistance: 0 + m_AngularXLimitSpring: + spring: 0 + damper: 0 + m_LowAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_HighAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularYZLimitSpring: + spring: 0 + damper: 0 + m_AngularYLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularZLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_TargetPosition: {x: 0, y: 0, z: 0} + m_TargetVelocity: {x: 0, y: 0, z: 0} + m_XDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_YDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_TargetRotation: {x: 0, y: 0, z: 0, w: 1} + m_TargetAngularVelocity: {x: 0, y: 0, z: 0} + m_RotationDriveMode: 0 + m_AngularXDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_AngularYZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_SlerpDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ProjectionMode: 1 + m_ProjectionDistance: 0 + m_ProjectionAngle: 0 + m_ConfiguredInWorldSpace: 0 + m_SwapBodies: 0 m_BreakForce: Infinity m_BreakTorque: Infinity - m_EnableCollision: 1 + m_EnableCollision: 0 m_EnablePreprocessing: 1 m_MassScale: 1 m_ConnectedMassScale: 1 @@ -412,7 +490,7 @@ GameObject: m_Component: - component: {fileID: 4530253318796540} - component: {fileID: 54298866000586118} - - component: {fileID: 4027588950793546390} + - component: {fileID: 4367274852511404246} - component: {fileID: 8491405271793597799} m_Layer: 16 m_Name: Float @@ -463,8 +541,8 @@ Rigidbody: m_Interpolate: 0 m_Constraints: 0 m_CollisionDetection: 2 ---- !u!145 &4027588950793546390 -SpringJoint: +--- !u!153 &4367274852511404246 +ConfigurableJoint: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} @@ -474,16 +552,94 @@ SpringJoint: m_ConnectedBody: {fileID: 5597807613657979793} m_ConnectedArticulationBody: {fileID: 0} m_Anchor: {x: 0, y: 0, z: 0} - m_AutoConfigureConnectedAnchor: 1 - m_ConnectedAnchor: {x: 0, y: 0, z: 0} - m_Spring: 10000 - m_Damper: 1 - m_MinDistance: 0 - m_MaxDistance: 0 - m_Tolerance: 0.025 + m_Axis: {x: 1, y: 0, z: 0} + m_AutoConfigureConnectedAnchor: 0 + m_ConnectedAnchor: {x: 0, y: -0.01, z: 0} + m_SecondaryAxis: {x: 0, y: 1, z: 0} + m_XMotion: 1 + m_YMotion: 1 + m_ZMotion: 1 + m_AngularXMotion: 2 + m_AngularYMotion: 2 + m_AngularZMotion: 2 + m_LinearLimitSpring: + spring: 0 + damper: 0 + m_LinearLimit: + limit: 0.5 + bounciness: 0 + contactDistance: 0 + m_AngularXLimitSpring: + spring: 0 + damper: 0 + m_LowAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_HighAngularXLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularYZLimitSpring: + spring: 0 + damper: 0 + m_AngularYLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_AngularZLimit: + limit: 0 + bounciness: 0 + contactDistance: 0 + m_TargetPosition: {x: 0, y: 0, z: 0} + m_TargetVelocity: {x: 0, y: 0, z: 0} + m_XDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_YDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_TargetRotation: {x: 0, y: 0, z: 0, w: 1} + m_TargetAngularVelocity: {x: 0, y: 0, z: 0} + m_RotationDriveMode: 0 + m_AngularXDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_AngularYZDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_SlerpDrive: + serializedVersion: 4 + positionSpring: 0 + positionDamper: 0 + maximumForce: 3.4028233e+38 + useAcceleration: 0 + m_ProjectionMode: 1 + m_ProjectionDistance: 0 + m_ProjectionAngle: 0 + m_ConfiguredInWorldSpace: 0 + m_SwapBodies: 0 m_BreakForce: Infinity m_BreakTorque: Infinity - m_EnableCollision: 1 + m_EnableCollision: 0 m_EnablePreprocessing: 1 m_MassScale: 1 m_ConnectedMassScale: 1 diff --git a/Assets/Scripts/Fishing/Item/FishingLine/FLineLogicNode.cs b/Assets/Scripts/Fishing/Item/FishingLine/FLineLogicNode.cs index 20f4a8f32..e0f1c1044 100644 --- a/Assets/Scripts/Fishing/Item/FishingLine/FLineLogicNode.cs +++ b/Assets/Scripts/Fishing/Item/FishingLine/FLineLogicNode.cs @@ -19,7 +19,7 @@ namespace NBF [SerializeField] private Rigidbody preRigidbody; private Rigidbody _rb; - private SpringJoint _joint; + private ConfigurableJoint _joint; private FLine _parentCable; private float _lenght; @@ -27,7 +27,7 @@ namespace NBF public Rigidbody PreRigidbody => preRigidbody; public Rigidbody Rigidbody => _rb; public FLine ParentCable => _parentCable; - public SpringJoint Joint => _joint; + public ConfigurableJoint Joint => _joint; public float Lenght => _lenght; @@ -37,7 +37,7 @@ namespace NBF { _rb = GetComponent(); _parentCable = GetComponentInParent(); - _joint = GetComponent(); + _joint = GetComponent(); } public void SetLenght(float lenght) @@ -45,7 +45,7 @@ namespace NBF _lenght = lenght; if (_joint) { - _joint.maxDistance = lenght; + _joint.linearLimit = new SoftJointLimit() { limit = lenght }; } if (rope) diff --git a/Assets/Scripts/Fishing/Mono/PlayerAnimator.cs b/Assets/Scripts/Fishing/Mono/PlayerAnimator.cs index 9e1e29139..9f03756f1 100644 --- a/Assets/Scripts/Fishing/Mono/PlayerAnimator.cs +++ b/Assets/Scripts/Fishing/Mono/PlayerAnimator.cs @@ -93,15 +93,15 @@ namespace NBF } - // public void OnUseItem(PlayerItemView item) - // { - // var itemType = item.Item.ConfigID.GetItemType(); - // if (itemType == ItemType.Rod) - // { - // _isRodLayerEnabled = true; - // // _IK.SetBipedLeftHandIK(enabled: false, reel.FingersIKAnchor); - // } - // } + public void OnUseItem(int configId) + { + var itemType = configId.GetItemType(); + if (itemType == ItemType.Rod) + { + _isRodLayerEnabled = true; + // _IK.SetBipedLeftHandIK(enabled: false, reel.FingersIKAnchor); + } + } public void SetLayerWeight(string layer, float weight) @@ -153,14 +153,13 @@ namespace NBF public void OnRodThrowStart() { Debug.LogError("OnRodThrowStart"); - // if (Player.State == PlayerState.Throw) - // { - // var playerStateView = Player.GetComponent(); - // if (playerStateView.CurrentStateView is PlayerStageViewThrow playerStateThrow) - // { - // playerStateThrow.OnRodThrowStart(); - // } - // } + if (Player.State == PlayerState.Throw) + { + if (Player.CurrentStateView is PlayerStageViewThrow playerStateThrow) + { + playerStateThrow.OnRodThrowStart(); + } + } } /// @@ -169,14 +168,13 @@ namespace NBF public void OnRodThrownEnd() { Debug.LogError("OnRodThrownEnd"); - // if (Player.State == PlayerState.Throw) - // { - // var playerStateView = Player.GetComponent(); - // if (playerStateView.CurrentStateView is PlayerStageViewThrow playerStateThrow) - // { - // playerStateThrow.OnRodThrownEnd(); - // } - // } + if (Player.State == PlayerState.Throw) + { + if (Player.CurrentStateView is PlayerStageViewThrow playerStateThrow) + { + playerStateThrow.OnRodThrownEnd(); + } + } } #endregion diff --git a/Assets/Scripts/Fishing/Player/Player.State.cs b/Assets/Scripts/Fishing/Player/Player.State.cs index e55b3079f..a41d3dedb 100644 --- a/Assets/Scripts/Fishing/Player/Player.State.cs +++ b/Assets/Scripts/Fishing/Player/Player.State.cs @@ -25,6 +25,8 @@ namespace NBF new Dictionary(); private PlayerStageViewBase _currentStateView; + + public PlayerStageViewBase CurrentStateView => _currentStateView; private void InitState() { diff --git a/Assets/Scripts/Fishing/Player/Player.cs b/Assets/Scripts/Fishing/Player/Player.cs index bffb67f15..5aeae3c15 100644 --- a/Assets/Scripts/Fishing/Player/Player.cs +++ b/Assets/Scripts/Fishing/Player/Player.cs @@ -87,38 +87,18 @@ namespace NBF } var itemConfig = Game.Tables.TbItem.Get(configId); - var Rod = itemConfig.InstantiateAndComponent(Map.Instance.GearsNode, Vector3.zero, + var rod = itemConfig.InstantiateAndComponent(Map.Instance.GearsNode, Vector3.zero, Quaternion.identity); - await Rod.Init(this, configId, bindItems); - HandItem = Rod; + await rod.Init(this, configId, bindItems); + HandItem = rod; - // ModelAsset.PlayerAnimator.OnUseItem(itemView); - - // if (currItem == null) - // { - // //收起物品 - // await UnUseItem(prevItem); - // } - // else - // { - // // 先收起旧的物品 - // await UnUseItemConfirm(prevItem); - // var handItem = Player.HandItem; - // //拿起新物品 - // var itemType = handItem.ConfigID.GetItemType(); - // if (itemType == ItemType.Rod) - // { - // var itemView = handItem.GetOrAddComponent(); - // await itemView.InitShow(handItem); - // Unity.ModelAsset.PlayerAnimator.OnUseItem(itemView); - // } - // } - // - // var stateView = Player.GetComponent(); - // if (stateView != null && stateView.CurrentStateView is PlayerStageViewIdle playerStageViewIdle) - // { - // playerStageViewIdle.TakeLine(); - // } + ModelAsset.PlayerAnimator.OnUseItem(configId); + + + if (_currentStateView is PlayerStageViewIdle playerStageViewIdle) + { + playerStageViewIdle.TakeLine(); + } IsChangeItemIng = false; }