From bfdfcfe2cde8f12956f725806f373373645ca040 Mon Sep 17 00:00:00 2001 From: BobSong <605277374@qq.com> Date: Thu, 1 Jan 2026 23:57:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Examples/Content/Materials/floor_mat.mat | 74 ++++- .../Examples/Content/Materials/player_mat.mat | 75 ++++- .../example_bool_tutorialCompleted.asset | 14 +- .../Editor/TypeRegistryUserConfig.asset | 24 ++ .../Editor/TypeRegistryUserConfig.asset.meta | 8 + .../Odin Inspector/Config/Resources.meta | 8 + .../Config/Resources/Sirenix.meta | 8 + .../Sirenix/GlobalSerializationConfig.asset | 22 ++ .../GlobalSerializationConfig.asset.meta | 8 + Assets/Scripts/Fishing/Player/FPlayer.cs | 16 +- Assets/Scripts/Fishing/Player/FPlayerData.cs | 5 + .../Scripts/Fishing/Player/PlayerAnimator.cs | 305 +++++++++--------- UserSettings/EditorUserSettings.asset | 20 +- 13 files changed, 407 insertions(+), 180 deletions(-) create mode 100644 Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/TypeRegistryUserConfig.asset create mode 100644 Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/TypeRegistryUserConfig.asset.meta create mode 100644 Assets/Plugins/Sirenix/Odin Inspector/Config/Resources.meta create mode 100644 Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix.meta create mode 100644 Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix/GlobalSerializationConfig.asset create mode 100644 Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix/GlobalSerializationConfig.asset.meta diff --git a/Assets/Obvious/Soap/Examples/Content/Materials/floor_mat.mat b/Assets/Obvious/Soap/Examples/Content/Materials/floor_mat.mat index 6b57d79ff..cab813d86 100644 --- a/Assets/Obvious/Soap/Examples/Content/Materials/floor_mat.mat +++ b/Assets/Obvious/Soap/Examples/Content/Materials/floor_mat.mat @@ -1,24 +1,47 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!114 &-1613675368179462854 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion + version: 10 --- !u!21 &2100000 Material: - serializedVersion: 6 + serializedVersion: 8 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: floor_mat - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: [] + m_InvalidKeywords: [] m_LightmapFlags: 4 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: m_SavedProperties: serializedVersion: 3 m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} - _BumpMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} @@ -55,11 +78,39 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 - _DetailNormalMapScale: 1 - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 - _GlossMapScale: 1 - _Glossiness: 0.5 - _GlossyReflections: 1 @@ -67,11 +118,22 @@ Material: - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 - _UVSec: 0 + - _WorkflowMode: 1 + - _XRMotionVectorsPass: 1 - _ZWrite: 1 m_Colors: - - _Color: {r: 0.47058824, g: 0.43529412, b: 0.6509804, a: 1} + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} + - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/Obvious/Soap/Examples/Content/Materials/player_mat.mat b/Assets/Obvious/Soap/Examples/Content/Materials/player_mat.mat index 0eee609f6..4b8c6adec 100644 --- a/Assets/Obvious/Soap/Examples/Content/Materials/player_mat.mat +++ b/Assets/Obvious/Soap/Examples/Content/Materials/player_mat.mat @@ -1,24 +1,48 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!114 &-1588398762897992864 +MonoBehaviour: + m_ObjectHideFlags: 11 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion + version: 10 --- !u!21 &2100000 Material: - serializedVersion: 6 + serializedVersion: 8 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: player_mat - m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: _EMISSION + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _EMISSION + m_InvalidKeywords: [] m_LightmapFlags: 1 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 m_CustomRenderQueue: -1 - stringTagMap: {} - disabledShaderPasses: [] + stringTagMap: + RenderType: Opaque + disabledShaderPasses: + - MOTIONVECTORS + m_LockedProperties: m_SavedProperties: serializedVersion: 3 m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} - _BumpMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} @@ -42,7 +66,7 @@ Material: - _MainTex: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} - m_Offset: {x: -0.27, y: 0} + m_Offset: {x: 0, y: 0} - _MetallicGlossMap: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} @@ -55,11 +79,39 @@ Material: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] m_Floats: + - _AddPrecomputedVelocity: 0 + - _AlphaClip: 0 + - _AlphaToMask: 0 + - _Blend: 0 + - _BlendModePreserveSpecular: 1 - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 - _DetailNormalMapScale: 1 - _DstBlend: 0 + - _DstBlendAlpha: 0 + - _EnvironmentReflections: 1 - _GlossMapScale: 1 - _Glossiness: 0 - _GlossyReflections: 1 @@ -67,11 +119,22 @@ Material: - _Mode: 0 - _OcclusionStrength: 1 - _Parallax: 0.02 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 - _SmoothnessTextureChannel: 0 - _SpecularHighlights: 1 - _SrcBlend: 1 + - _SrcBlendAlpha: 1 + - _Surface: 0 - _UVSec: 0 + - _WorkflowMode: 1 + - _XRMotionVectorsPass: 1 - _ZWrite: 1 m_Colors: + - _BaseColor: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0.2830189, g: 0.2830189, b: 0.2830189, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] + m_AllowLocking: 1 diff --git a/Assets/Obvious/Soap/Examples/Content/ScriptableVariables/example_bool_tutorialCompleted.asset b/Assets/Obvious/Soap/Examples/Content/ScriptableVariables/example_bool_tutorialCompleted.asset index df941e968..db1da2110 100644 --- a/Assets/Obvious/Soap/Examples/Content/ScriptableVariables/example_bool_tutorialCompleted.asset +++ b/Assets/Obvious/Soap/Examples/Content/ScriptableVariables/example_bool_tutorialCompleted.asset @@ -12,11 +12,23 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6a11231538da9894d8dce88b47df6a36, type: 3} m_Name: example_bool_tutorialCompleted m_EditorClassIdentifier: + serializationData: + SerializedFormat: 2 + SerializedBytes: + ReferencedUnityObjects: [] + SerializedBytesString: + Prefab: {fileID: 0} + PrefabModificationsReferencedUnityObjects: [] + PrefabModifications: [] + SerializationNodes: + - Name: RepaintRequest + Entry: 6 + Data: TagIndex: 0 Description: _guid: 1afe66c634254d647bce4ea62658436e _saveGuid: 0 - _value: 0 + _value: 1 _debugLogEnabled: 0 _saved: 1 _defaultValue: 0 diff --git a/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/TypeRegistryUserConfig.asset b/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/TypeRegistryUserConfig.asset new file mode 100644 index 000000000..da68e0e55 --- /dev/null +++ b/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/TypeRegistryUserConfig.asset @@ -0,0 +1,24 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 2050440665, guid: a4865f1ab4504ed8a368670db22f409c, type: 3} + m_Name: TypeRegistryUserConfig + m_EditorClassIdentifier: Sirenix.OdinInspector.Editor.dll::Sirenix.Config.TypeRegistryUserConfig + shownTypes: + serializedCollection: [] + hiddenTypes: + serializedCollection: [] + addedIllegalTypes: + serializedCollection: [] + typeSettings: + serializedDictionary: [] + typePriorities: + serializedDictionary: [] diff --git a/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/TypeRegistryUserConfig.asset.meta b/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/TypeRegistryUserConfig.asset.meta new file mode 100644 index 000000000..51f2e1f8f --- /dev/null +++ b/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/TypeRegistryUserConfig.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 224432952a55045429013eba1c2f3949 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources.meta b/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources.meta new file mode 100644 index 000000000..7f272dc56 --- /dev/null +++ b/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a9f64cdd18807f04c84562c2f541a67b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix.meta b/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix.meta new file mode 100644 index 000000000..496794333 --- /dev/null +++ b/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3eda7121447d8e54d8915a386553918b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix/GlobalSerializationConfig.asset b/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix/GlobalSerializationConfig.asset new file mode 100644 index 000000000..6191590ff --- /dev/null +++ b/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix/GlobalSerializationConfig.asset @@ -0,0 +1,22 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1549551891, guid: 74721b9f0af448f5ae2e91102a1a5edd, type: 3} + m_Name: GlobalSerializationConfig + m_EditorClassIdentifier: Sirenix.Serialization.Config.dll::Sirenix.Serialization.GlobalSerializationConfig + HideSerializationCautionaryMessage: 0 + HidePrefabCautionaryMessage: 0 + HideOdinSerializeAttributeWarningMessages: 0 + HideNonSerializedShowInInspectorWarningMessages: 0 + buildSerializationFormat: 0 + editorSerializationFormat: 2 + loggingPolicy: 0 + errorHandlingPolicy: 0 diff --git a/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix/GlobalSerializationConfig.asset.meta b/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix/GlobalSerializationConfig.asset.meta new file mode 100644 index 000000000..aaf90c0c9 --- /dev/null +++ b/Assets/Plugins/Sirenix/Odin Inspector/Config/Resources/Sirenix/GlobalSerializationConfig.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 00462f07bb06efa4b92140f5a8773670 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Fishing/Player/FPlayer.cs b/Assets/Scripts/Fishing/Player/FPlayer.cs index fc159c4e0..753eafec4 100644 --- a/Assets/Scripts/Fishing/Player/FPlayer.cs +++ b/Assets/Scripts/Fishing/Player/FPlayer.cs @@ -26,7 +26,7 @@ namespace NBF public FPlayerData Data { get; private set; } public readonly List Tackles = new List(); - public FRod HandTackle { get; private set; } + public FRod Rod { get; private set; } protected override void OnAwake() { @@ -73,17 +73,17 @@ namespace NBF if (itemType == ItemType.Rod) { //判断旧的是否要收回 - if (HandTackle != null) + if (Rod != null) { - yield return HandTackle.Destroy(); - Tackles.Remove(HandTackle); - HandTackle = null; + yield return Rod.Destroy(); + Tackles.Remove(Rod); + Rod = null; } - HandTackle = + Rod = item.Config.InstantiateAndComponent(SceneSettings.Instance.GearNode, Vector3.zero, Quaternion.identity); - yield return HandTackle.InitRod(this, item); - Tackles.Add(HandTackle); + yield return Rod.InitRod(this, item); + Tackles.Add(Rod); } } diff --git a/Assets/Scripts/Fishing/Player/FPlayerData.cs b/Assets/Scripts/Fishing/Player/FPlayerData.cs index f9f8e65d8..eea10ca62 100644 --- a/Assets/Scripts/Fishing/Player/FPlayerData.cs +++ b/Assets/Scripts/Fishing/Player/FPlayerData.cs @@ -5,6 +5,7 @@ namespace NBF { public class FPlayerData : MonoService { + private PlayerState _previousPlayerState = PlayerState.idle; private PlayerState _playerState; public bool Run; @@ -14,11 +15,15 @@ namespace NBF public Vector2 MoveInput; + + public PlayerState PreviousState => _previousPlayerState; + public PlayerState State { get => _playerState; set { + _previousPlayerState = _playerState; _playerState = value; OnStateChange?.Invoke(_playerState); } diff --git a/Assets/Scripts/Fishing/Player/PlayerAnimator.cs b/Assets/Scripts/Fishing/Player/PlayerAnimator.cs index dd1b59221..ef4a41fbe 100644 --- a/Assets/Scripts/Fishing/Player/PlayerAnimator.cs +++ b/Assets/Scripts/Fishing/Player/PlayerAnimator.cs @@ -14,6 +14,7 @@ namespace NBF private bool _isInit; private PlayerIK _IK; private MagicBlending _magicBlending; + private bool _IsInVehicle; #region 参数定义 @@ -58,12 +59,12 @@ namespace NBF _IK = GetComponent(); _isInit = true; - // Player.Data.OnStateChange += PlayerFSMState_OnValueChanged; + Player.Data.OnStateChange += PlayerFSMState_OnValueChanged; } private void OnDestroy() { - // Player.Data.OnStateChange += PlayerFSMState_OnValueChanged; + Player.Data.OnStateChange += PlayerFSMState_OnValueChanged; } // private void OnEnable() @@ -76,158 +77,164 @@ namespace NBF // playerFSMState.OnValueChanged -= PlayerFSMState_OnValueChanged; // } - // private void OnFishingSetUnequip() - // { - // _isTorsoLayerEnabled = false; - // _IK.SetBipedLeftHandIK(enabled: false, null); - // } - // - // private void OnCastLure() - // { - // playerFSMState.Value = PlayerState.baitFlies; - // SFXGameManagement.PlaySound("Cast Fishing Rod", base.transform); - // } - // - // private void OnBailUnnarm() - // { - // if (IsThrowButtonPressed.Value) - // { - // _Animator.SetBool(ThrowFar, value: true); - // playerFSMState.Value = PlayerState.casting; - // OnBailOpen?.Invoke(); - // } - // } - // + private void OnFishingSetUnequip() + { + _isTorsoLayerEnabled = false; + _IK.SetBipedLeftHandIK(enabled: false, null); + } + + private void OnCastLure() + { + Player.Data.State = PlayerState.baitFlies; + // SFXGameManagement.PlaySound("Cast Fishing Rod", base.transform); + } + + private void OnBailUnnarm() + { + // if (IsThrowButtonPressed.Value) + // { + // _Animator.SetBool(ThrowFar, value: true); + // Player.Data.State = PlayerState.casting; + // OnBailOpen?.Invoke(); + // } + } + // private void OnFishingSetEquiped_OnRaised(FishingSetController set) // { // _isTorsoLayerEnabled = true; - // _IK.SetBipedLeftHandIK(enabled: false, set.AttachedReel.FingersIKAnchor); - // } - // - // private void PlayAnimation(string state, string layer) - // { - // _Animator.CrossFade(state, 0.3f, _Animator.GetLayerIndex(layer)); - // } - // - // public void PlayPreciseCastAnimation() - // { - // _Animator.SetBool(PreciseIdle, value: false); - // _Animator.SetTrigger(PreciseCast); - // } - // - // public void SetLayerWeight(string layer, float weight) - // { - // _Animator.SetLayerWeight(_Animator.GetLayerIndex(layer), weight); - // } - // - // private void PlayerFSMState_OnValueChanged(PlayerState state) - // { - // switch (playerFSMState.PreviousValue) - // { - // case PlayerState.vehicle: - // _IsInVehicle = false; - // _Animator.SetBool(BoatDriving, value: false); - // break; - // case PlayerState.swiming: - // _Animator.SetBool(IsSwiming, value: false); - // break; - // case PlayerState.preciseCastIdle: - // _Animator.SetBool(PreciseIdle, value: false); - // break; - // case PlayerState.prepare: - // _Animator.SetBool(RodArming, value: false); - // break; - // case PlayerState.casting: - // _Animator.SetBool(ThrowFar, value: false); - // break; - // case PlayerState.collectFish: - // _magicBlending.BlendAsset.globalWeight = 0f; - // break; - // } - // - // switch (state) - // { - // case PlayerState.idle: - // case PlayerState.move: - // _Animator.SetBool(BaitInWater, value: false); - // _Animator.SetBool(HeldRod, value: false); - // _Animator.SetBool(ThrowFar, value: false); - // _Animator.SetBool(RodArming, value: false); - // break; - // case PlayerState.prepare: - // _Animator.SetBool(RodArming, value: true); - // _Animator.SetBool(HeldRod, value: true); - // break; - // case PlayerState.fishing: - // _Animator.SetBool(HeldRod, value: true); - // _Animator.SetBool(BaitInWater, value: true); - // break; - // case PlayerState.vehicle: - // _Animator.SetBool(BaitInWater, value: false); - // _Animator.SetBool(HeldRod, value: false); - // _Animator.SetBool(ThrowFar, value: false); - // _Animator.SetBool(RodArming, value: false); - // _Animator.SetBool(BoatDriving, value: true); - // _IK.SetBipedLeftHandIK(enabled: true); - // _IsInVehicle = true; - // break; - // case PlayerState.vehicleFishing: - // _Animator.SetBool(BaitInWater, value: false); - // _Animator.SetBool(HeldRod, value: false); - // _Animator.SetBool(ThrowFar, value: false); - // _Animator.SetBool(RodArming, value: false); - // _IsInVehicle = true; - // break; - // case PlayerState.swiming: - // _Animator.SetBool(IsSwiming, value: true); - // break; - // case PlayerState.collectFish: - // _Animator.SetBool(BaitInWater, value: false); - // _IK.SetAimIK(enabled: false); - // _magicBlending.BlendAsset.globalWeight = 1f; - // break; - // case PlayerState.preciseCastIdle: - // _Animator.SetBool(PreciseIdle, value: true); - // break; - // case PlayerState.casting: - // case PlayerState.baitFlies: - // case PlayerState.fight: - // case PlayerState.fishView: - // case PlayerState.throwFish: - // case PlayerState.flyModeDebug: - // break; - // } - // } - // - // private void LateUpdate() - // { - // if (playerFSMState.Value == PlayerState.swiming) - // { - // float value = Mathf.Lerp(_Animator.GetFloat(Forward), currentMoveSpeed.Value / 2.5f, - // Time.deltaTime * 5f); - // float value2 = Mathf.Lerp(_Animator.GetFloat(Turn), RotationSpeed.Value, Time.deltaTime * 5f); - // _Animator.SetFloat(Forward, Mathf.Clamp01(value)); - // _Animator.SetFloat(Turn, Mathf.Clamp(value2, -1f, 1f)); - // } - // else - // { - // float value3 = Mathf.Lerp(_Animator.GetFloat(Forward), currentMoveSpeed.Value / 5f, - // Time.deltaTime * 20f); - // float value4 = Mathf.Lerp(_Animator.GetFloat(Turn), RotationSpeed.Value, Time.deltaTime * 15f); - // _Animator.SetFloat(Forward, Mathf.Clamp01(value3)); - // _Animator.SetFloat(Turn, Mathf.Clamp(value4, -1f, 1f)); - // } - // - // _Animator.SetBool(OnGround, _IsInVehicle || isGrounded.Value); - // _Animator.SetFloat(RodRight, rodPosition.Value.x); - // _Animator.SetFloat(RodForward, rodPosition.Value.y); - // float layerWeight = _Animator.GetLayerWeight(_Animator.GetLayerIndex("Torso")); - // SetLayerWeight("Torso", - // Mathf.MoveTowards(layerWeight, _isTorsoLayerEnabled ? 1f : 0f, Time.deltaTime * 3f)); + // var reel = Player.Rod.Reel; + // // _IK.SetBipedLeftHandIK(enabled: false, reel.FingersIKAnchor); // } - - + private void PlayAnimation(string state, string layer) + { + _Animator.CrossFade(state, 0.3f, _Animator.GetLayerIndex(layer)); + } + + public void PlayPreciseCastAnimation() + { + _Animator.SetBool(PreciseIdle, value: false); + _Animator.SetTrigger(PreciseCast); + } + + public void SetLayerWeight(string layer, float weight) + { + _Animator.SetLayerWeight(_Animator.GetLayerIndex(layer), weight); + } + + private void PlayerFSMState_OnValueChanged(PlayerState state) + { + switch (Player.Data.PreviousState) + { + case PlayerState.vehicle: + _IsInVehicle = false; + _Animator.SetBool(BoatDriving, value: false); + break; + case PlayerState.swiming: + _Animator.SetBool(IsSwiming, value: false); + break; + case PlayerState.preciseCastIdle: + _Animator.SetBool(PreciseIdle, value: false); + break; + case PlayerState.prepare: + _Animator.SetBool(RodArming, value: false); + break; + case PlayerState.casting: + _Animator.SetBool(ThrowFar, value: false); + break; + case PlayerState.collectFish: + _magicBlending.BlendAsset.globalWeight = 0f; + break; + } + + switch (state) + { + case PlayerState.idle: + case PlayerState.move: + _Animator.SetBool(BaitInWater, value: false); + _Animator.SetBool(HeldRod, value: false); + _Animator.SetBool(ThrowFar, value: false); + _Animator.SetBool(RodArming, value: false); + break; + case PlayerState.prepare: + _Animator.SetBool(RodArming, value: true); + _Animator.SetBool(HeldRod, value: true); + break; + case PlayerState.fishing: + _Animator.SetBool(HeldRod, value: true); + _Animator.SetBool(BaitInWater, value: true); + break; + case PlayerState.vehicle: + _Animator.SetBool(BaitInWater, value: false); + _Animator.SetBool(HeldRod, value: false); + _Animator.SetBool(ThrowFar, value: false); + _Animator.SetBool(RodArming, value: false); + _Animator.SetBool(BoatDriving, value: true); + _IK.SetBipedLeftHandIK(enabled: true); + _IsInVehicle = true; + break; + case PlayerState.vehicleFishing: + _Animator.SetBool(BaitInWater, value: false); + _Animator.SetBool(HeldRod, value: false); + _Animator.SetBool(ThrowFar, value: false); + _Animator.SetBool(RodArming, value: false); + _IsInVehicle = true; + break; + case PlayerState.swiming: + _Animator.SetBool(IsSwiming, value: true); + break; + case PlayerState.collectFish: + _Animator.SetBool(BaitInWater, value: false); + _IK.SetAimIK(enabled: false); + _magicBlending.BlendAsset.globalWeight = 1f; + break; + case PlayerState.preciseCastIdle: + _Animator.SetBool(PreciseIdle, value: true); + break; + case PlayerState.casting: + case PlayerState.baitFlies: + case PlayerState.fight: + case PlayerState.fishView: + case PlayerState.throwFish: + case PlayerState.flyModeDebug: + break; + } + } + + private void LateUpdate() + { + if (Player.Data.State == PlayerState.swiming) + { + float value = Mathf.Lerp(_Animator.GetFloat(Forward), Player.Data.Speed / 2.5f, + Time.deltaTime * 5f); + float value2 = Mathf.Lerp(_Animator.GetFloat(Turn), Player.Data.RotationSpeed, Time.deltaTime * 5f); + _Animator.SetFloat(Forward, Mathf.Clamp01(value)); + _Animator.SetFloat(Turn, Mathf.Clamp(value2, -1f, 1f)); + } + else + { + float value3 = Mathf.Lerp(_Animator.GetFloat(Forward), Player.Data.Speed / 5f, + Time.deltaTime * 20f); + float value4 = Mathf.Lerp(_Animator.GetFloat(Turn), Player.Data.RotationSpeed, Time.deltaTime * 15f); + _Animator.SetFloat(Forward, Mathf.Clamp01(value3)); + _Animator.SetFloat(Turn, Mathf.Clamp(value4, -1f, 1f)); + } + + var rod = Vector3.zero; + if (Player.Rod) + { + rod = Player.Rod.transform.position; + } + + _Animator.SetBool(OnGround, _IsInVehicle || Player.Data.IsGrounded); + _Animator.SetFloat(RodRight, rod.x); + _Animator.SetFloat(RodForward, rod.y); + float layerWeight = _Animator.GetLayerWeight(_Animator.GetLayerIndex(Torso)); + SetLayerWeight(Torso, + Mathf.MoveTowards(layerWeight, _isTorsoLayerEnabled ? 1f : 0f, Time.deltaTime * 3f)); + } + + // private void LateUpdate() // { // if (!_isInit) return; diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 3d3e16179..e819cd617 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -9,32 +9,32 @@ EditorUserSettings: value: 18134705175a055722080a3115371d4a0d55006876786860616b0471b8b3666cacb72ba5a52a362c3c0ee63201181433fe3e101bf3250b06144ca74c24f1190708e016c213c61a52f91c12cac80fd8edd298e1e4d1fde2cacddeacbcc1fee7eef0e3b6faa69af9ceaeaaec81a6d2c2c8c8c4b2e5dfd5ccd3f8cf flags: 0 RecentlyUsedSceneGuid-0: - value: 5702075052030b0e5458087142770745104f4a7d747d72667e2d4d36b2b8676f - flags: 0 - RecentlyUsedSceneGuid-1: value: 5a520c0256040b0b0f5d5a7643775914474e412e2f70243678704c6ae0e16c6d flags: 0 - RecentlyUsedSceneGuid-2: + RecentlyUsedSceneGuid-1: value: 0503575f5c57085954560d2447775e4513151e7c292c2035787f4b60b4e23760 flags: 0 - RecentlyUsedSceneGuid-3: + RecentlyUsedSceneGuid-2: value: 02550255060d590c0c0b097016770b12444f1e2b7e2a2534797f4b60b6e46c60 flags: 0 - RecentlyUsedSceneGuid-4: + RecentlyUsedSceneGuid-3: value: 5b520400060d5a5a5b5b557641770b43424f1c28787d25612b2d196ab0b66068 flags: 0 - RecentlyUsedSceneGuid-5: + RecentlyUsedSceneGuid-4: value: 52530c5601535f020f565a2043770d1612154d2f747975692c7b4e66b5e3303b flags: 0 - RecentlyUsedSceneGuid-6: + RecentlyUsedSceneGuid-5: value: 5303020755510a0f5e085c2744775a40454e1a2f282b72632f284d61e1e5673d flags: 0 - RecentlyUsedSceneGuid-7: + RecentlyUsedSceneGuid-6: value: 565700055d51590c0f56557545710744124f492b2a2976662828456ae6b03269 flags: 0 - RecentlyUsedSceneGuid-8: + RecentlyUsedSceneGuid-7: value: 5309035757065a0a54575f7216265c4444151d28792e72627d2f1935bbb8673a flags: 0 + RecentlyUsedSceneGuid-8: + value: 0254070454505a0d55595d2113250844404f48297b7927342e281b6ab7b2676d + flags: 0 RecentlyUsedSceneGuid-9: value: 5505015f5c515a085f5b092149760f441716407a787d7564287b1b36e7e1366e flags: 0