From 23e7a288c0b91d858a76172f780c192c76c6eb12 Mon Sep 17 00:00:00 2001 From: Jakub Sztuba Date: Tue, 31 May 2022 23:53:48 +0200 Subject: [PATCH] Added attacking move --- Assembly-CSharp.csproj | 75 +++++---- .../MainCharacter/mainCh_standing.controller | 157 ++++++++++++++++++ .../Monster/Slime/Slime_0.controller | 2 +- Assets/Scripts/Player.cs | 30 +++- UserSettings/EditorUserSettings.asset | 4 +- 5 files changed, 228 insertions(+), 40 deletions(-) diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index 606f4ac7..ecf44e8b 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -2,8 +2,10 @@ latest - C:\Program Files\Unity\Hub\Editor\2020.3.32f1\Editor\Data\Tools\RoslynScripts - unity_csc.bat + <_TargetFrameworkDirectories>non_empty_path_generated_by_unity.rider.package + <_FullFrameworkReferenceAssemblyPaths>non_empty_path_generated_by_unity.rider.package + true + Debug @@ -11,7 +13,8 @@ 10.0.20506 2.0 - {F58AF4E0-3E6D-54B1-523D-8F755DC8E665} + {951fac91-10b1-c9cb-e811-6cc5e294fc3b} + {E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} Library Properties Assembly-CSharp @@ -27,8 +30,9 @@ DEBUG;TRACE;UNITY_2020_3_32;UNITY_2020_3;UNITY_2020;UNITY_5_3_OR_NEWER;UNITY_5_4_OR_NEWER;UNITY_5_5_OR_NEWER;UNITY_5_6_OR_NEWER;UNITY_2017_1_OR_NEWER;UNITY_2017_2_OR_NEWER;UNITY_2017_3_OR_NEWER;UNITY_2017_4_OR_NEWER;UNITY_2018_1_OR_NEWER;UNITY_2018_2_OR_NEWER;UNITY_2018_3_OR_NEWER;UNITY_2018_4_OR_NEWER;UNITY_2019_1_OR_NEWER;UNITY_2019_2_OR_NEWER;UNITY_2019_3_OR_NEWER;UNITY_2019_4_OR_NEWER;UNITY_2020_1_OR_NEWER;UNITY_2020_2_OR_NEWER;UNITY_2020_3_OR_NEWER;PLATFORM_ARCH_64;UNITY_64;UNITY_INCLUDE_TESTS;USE_SEARCH_ENGINE_API;SCENE_TEMPLATE_MODULE;ENABLE_AR;ENABLE_AUDIO;ENABLE_CACHING;ENABLE_CLOTH;ENABLE_EVENT_QUEUE;ENABLE_MICROPHONE;ENABLE_MULTIPLE_DISPLAYS;ENABLE_PHYSICS;ENABLE_TEXTURE_STREAMING;ENABLE_VIRTUALTEXTURING;ENABLE_UNET;ENABLE_LZMA;ENABLE_UNITYEVENTS;ENABLE_VR;ENABLE_WEBCAM;ENABLE_UNITYWEBREQUEST;ENABLE_WWW;ENABLE_CLOUD_SERVICES;ENABLE_CLOUD_SERVICES_COLLAB;ENABLE_CLOUD_SERVICES_COLLAB_SOFTLOCKS;ENABLE_CLOUD_SERVICES_ADS;ENABLE_CLOUD_SERVICES_USE_WEBREQUEST;ENABLE_CLOUD_SERVICES_CRASH_REPORTING;ENABLE_CLOUD_SERVICES_PURCHASING;ENABLE_CLOUD_SERVICES_ANALYTICS;ENABLE_CLOUD_SERVICES_UNET;ENABLE_CLOUD_SERVICES_BUILD;ENABLE_CLOUD_LICENSE;ENABLE_EDITOR_HUB_LICENSE;ENABLE_WEBSOCKET_CLIENT;ENABLE_DIRECTOR_AUDIO;ENABLE_DIRECTOR_TEXTURE;ENABLE_MANAGED_JOBS;ENABLE_MANAGED_TRANSFORM_JOBS;ENABLE_MANAGED_ANIMATION_JOBS;ENABLE_MANAGED_AUDIO_JOBS;ENABLE_MANAGED_UNITYTLS;INCLUDE_DYNAMIC_GI;ENABLE_MONO_BDWGC;ENABLE_SCRIPTING_GC_WBARRIERS;PLATFORM_SUPPORTS_MONO;RENDER_SOFTWARE_CURSOR;ENABLE_VIDEO;PLATFORM_STANDALONE;PLATFORM_STANDALONE_WIN;UNITY_STANDALONE_WIN;UNITY_STANDALONE;ENABLE_RUNTIME_GI;ENABLE_MOVIES;ENABLE_NETWORK;ENABLE_CRUNCH_TEXTURE_COMPRESSION;ENABLE_OUT_OF_PROCESS_CRASH_HANDLER;ENABLE_CLUSTER_SYNC;ENABLE_CLUSTERINPUT;PLATFORM_UPDATES_TIME_OUTSIDE_OF_PLAYER_LOOP;GFXDEVICE_WAITFOREVENT_MESSAGEPUMP;ENABLE_WEBSOCKET_HOST;ENABLE_MONO;NET_STANDARD_2_0;ENABLE_PROFILER;UNITY_ASSERTIONS;UNITY_EDITOR;UNITY_EDITOR_64;UNITY_EDITOR_WIN;ENABLE_UNITY_COLLECTIONS_CHECKS;ENABLE_BURST_AOT;UNITY_TEAM_LICENSE;ENABLE_CUSTOM_RENDER_TEXTURE;ENABLE_DIRECTOR;ENABLE_LOCALIZATION;ENABLE_SPRITES;ENABLE_TERRAIN;ENABLE_TILEMAP;ENABLE_TIMELINE;ENABLE_LEGACY_INPUT_MANAGER;CSHARP_7_OR_LATER;CSHARP_7_3_OR_NEWER prompt 4 - 0169 + False + False pdbonly @@ -36,8 +40,9 @@ Temp\bin\Release\ prompt 4 - 0169 + False + False true @@ -656,94 +661,94 @@ C:/Program Files/Unity/Hub/Editor/2020.3.32f1/Editor/Data/NetStandard/compat/2.0.0/shims/netfx/System.Xml.Serialization.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.Animation.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEngineBridge.001.dll + C:/PI/Library/ScriptAssemblies/Unity.InternalAPIEngineBridge.001.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.VSCode.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.VSCode.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.PixelPerfect.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.Tilemap.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.Tilemap.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/PsdPlugin.dll + C:/PI/Library/ScriptAssemblies/PsdPlugin.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.TextMeshPro.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.VisualStudio.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.VisualStudio.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.Timeline.dll + C:/PI/Library/ScriptAssemblies/Unity.Timeline.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.TextMeshPro.dll + C:/PI/Library/ScriptAssemblies/Unity.TextMeshPro.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.IK.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.Sprite.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.Psdimporter.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.Psdimporter.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.Path.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.Path.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.InternalAPIEditorBridge.001.dll + C:/PI/Library/ScriptAssemblies/Unity.InternalAPIEditorBridge.001.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/UnityEditor.UI.dll + C:/PI/Library/ScriptAssemblies/UnityEditor.UI.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.PlasticSCM.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.PlasticSCM.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.Rider.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.Rider.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/UnityEngine.UI.dll + C:/PI/Library/ScriptAssemblies/UnityEngine.UI.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.dll + C:/PI/Library/ScriptAssemblies/Unity.Mathematics.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.IK.Runtime.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.IK.Runtime.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Triangle.Runtime.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.Animation.Triangle.Runtime.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.Animation.Runtime.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.Animation.Runtime.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.PixelPerfect.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.PixelPerfect.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.Timeline.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.Timeline.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.Mathematics.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.Mathematics.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Runtime.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.Common.Runtime.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.SpriteShape.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.Common.Editor.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.Common.Editor.dll - C:/Users/alicj/Desktop/Scriptum/Library/ScriptAssemblies/Unity.2D.SpriteShape.Runtime.dll + C:/PI/Library/ScriptAssemblies/Unity.2D.SpriteShape.Runtime.dll diff --git a/Assets/Animations/MainCharacter/mainCh_standing.controller b/Assets/Animations/MainCharacter/mainCh_standing.controller index 74d9145b..600a41eb 100644 --- a/Assets/Animations/MainCharacter/mainCh_standing.controller +++ b/Assets/Animations/MainCharacter/mainCh_standing.controller @@ -59,6 +59,7 @@ AnimatorState: m_CycleOffset: 0 m_Transitions: - {fileID: 3178665442510596103} + - {fileID: 2663480789015550344} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -74,6 +75,31 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1101 &-5632725443533880303 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: attack + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 764129659546702357} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.40000004 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &-5572165365293705200 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -99,6 +125,53 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!206 &-1633676018275584126 +BlendTree: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blend Tree + m_Childs: + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 2f980ae4637ab33478d95c20fc6ebda8, type: 2} + m_Threshold: 0 + m_Position: {x: 0, y: -0.1} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: moveX + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 2f980ae4637ab33478d95c20fc6ebda8, type: 2} + m_Threshold: 0.33333334 + m_Position: {x: 0, y: 0.1} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: moveX + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 691a3cb3a74b1fe4e978d1969f59d358, type: 2} + m_Threshold: 0.6666667 + m_Position: {x: 0.1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: moveX + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 94fcb34d793f89c459712b9cc54cbeff, type: 2} + m_Threshold: 1 + m_Position: {x: -0.1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: moveX + m_Mirror: 0 + m_BlendParameter: moveX + m_BlendParameterY: moveY + m_MinThreshold: 0 + m_MaxThreshold: 1 + m_UseAutomaticThresholds: 1 + m_NormalizedBlendValues: 0 + m_BlendType: 1 --- !u!206 &-1054270578012958368 BlendTree: m_ObjectHideFlags: 1 @@ -185,6 +258,12 @@ AnimatorController: m_DefaultInt: 0 m_DefaultBool: 0 m_Controller: {fileID: 0} + - m_Name: attack + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -198,6 +277,58 @@ AnimatorController: m_IKPass: 0 m_SyncedLayerAffectsTiming: 0 m_Controller: {fileID: 9100000} +--- !u!1102 &764129659546702357 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Attack + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 7551231252227633570} + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: -1633676018275584126} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1101 &2663480789015550344 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 1 + m_ConditionEvent: attack + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 764129659546702357} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1101 &3178665442510596103 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -235,6 +366,7 @@ AnimatorState: m_CycleOffset: 0 m_Transitions: - {fileID: -5572165365293705200} + - {fileID: -5632725443533880303} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -250,6 +382,28 @@ AnimatorState: m_MirrorParameter: m_CycleOffsetParameter: m_TimeParameter: +--- !u!1101 &7551231252227633570 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: [] + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 7257817922151744131} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0 + m_TransitionOffset: 0 + m_ExitTime: 0.75 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1107 &9041107495391884788 AnimatorStateMachine: serializedVersion: 6 @@ -265,6 +419,9 @@ AnimatorStateMachine: - serializedVersion: 1 m_State: {fileID: -5678147287597586547} m_Position: {x: 360, y: 0, z: 0} + - serializedVersion: 1 + m_State: {fileID: 764129659546702357} + m_Position: {x: 760, y: 40, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] diff --git a/Assets/Animations/Monster/Slime/Slime_0.controller b/Assets/Animations/Monster/Slime/Slime_0.controller index 47678aef..78ff5479 100644 --- a/Assets/Animations/Monster/Slime/Slime_0.controller +++ b/Assets/Animations/Monster/Slime/Slime_0.controller @@ -11,7 +11,7 @@ AnimatorStateMachine: m_ChildStates: - serializedVersion: 1 m_State: {fileID: -4755548940222940691} - m_Position: {x: 200, y: 0, z: 0} + m_Position: {x: 230, y: 10, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] diff --git a/Assets/Scripts/Player.cs b/Assets/Scripts/Player.cs index 37c3d186..e2f45158 100644 --- a/Assets/Scripts/Player.cs +++ b/Assets/Scripts/Player.cs @@ -12,18 +12,39 @@ public class Player : MonoBehaviour float inputHorizontal; float inputVertical; public FloatValue currentHealth; - + private bool attack; void Start() { rb = gameObject.GetComponent(); myAnimator = GetComponent(); } + private void HandleAttacks() + { + if (attack) + { + myAnimator.SetTrigger("attack"); + } + } + + private void HandleInput() + { + if (Input.GetKeyDown(KeyCode.Space)) + { + attack = true; + } + } + + private void ResetValues() + { + attack = false; + } + void Update() { inputHorizontal = Input.GetAxisRaw("Horizontal"); inputVertical = Input.GetAxisRaw("Vertical"); - + myAnimator.SetFloat("moveX", inputHorizontal * walkSpeed); myAnimator.SetFloat("moveY", inputVertical * walkSpeed); if (inputHorizontal != 0) @@ -44,6 +65,8 @@ public class Player : MonoBehaviour myAnimator.SetFloat("lastMoveX", inputHorizontal); myAnimator.SetFloat("lastMoveY", inputVertical); } + + HandleInput(); } void FixedUpdate() @@ -61,6 +84,9 @@ public class Player : MonoBehaviour { rb.velocity = new Vector2(0f, 0f); } + + HandleAttacks(); + ResetValues(); } } diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 84c05c45..06ddb362 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -30,10 +30,10 @@ EditorUserSettings: value: 22424703114646680e0b0227036c72111f19352f223d667d6d0a1532f0e1372ce7f518e8ea3f7129370bfb25 flags: 0 RecentlyUsedScenePath-8: - value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d + value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb flags: 0 RecentlyUsedScenePath-9: - value: 22424703114646680e0b0227036c72111f1958072926337e38271427fb + value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d flags: 0 vcSharedLogLevel: value: 0d5e400f0650