From 45cbbc3b3d6bb84eb7f329bcb33563e1f1f27549 Mon Sep 17 00:00:00 2001 From: Jakub Sztuba Date: Thu, 5 Jan 2023 14:53:42 +0100 Subject: [PATCH] Wizard Animation Upgrade --- .../WizardHouse/WizardController.controller | 99 +++++++++++++++++++ Assets/Scenes/WizardHouse.unity | 4 + Assets/Scripts/NPCs' Scripts/NPCFollowing.cs | 11 ++- Assets/Sprites/NPCs/WizardDown.anim | 8 +- Assets/Sprites/NPCs/WizardFrontIdle.anim | 68 +++++++++++++ Assets/Sprites/NPCs/WizardFrontIdle.anim.meta | 8 ++ Assets/Sprites/NPCs/WizardLeft.anim | 8 +- Assets/Sprites/NPCs/WizardRight.anim | 8 +- Assets/Sprites/NPCs/WizardUp.anim | 8 +- 9 files changed, 205 insertions(+), 17 deletions(-) create mode 100644 Assets/Sprites/NPCs/WizardFrontIdle.anim create mode 100644 Assets/Sprites/NPCs/WizardFrontIdle.anim.meta diff --git a/Assets/Resources/NPC/WizardHouse/WizardController.controller b/Assets/Resources/NPC/WizardHouse/WizardController.controller index 47118203..b17df6c4 100644 --- a/Assets/Resources/NPC/WizardHouse/WizardController.controller +++ b/Assets/Resources/NPC/WizardHouse/WizardController.controller @@ -1,5 +1,30 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1101 &-5806975412209012471 +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: isRunning + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: 5154281723833786323} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1107 &-3621334542891261866 AnimatorStateMachine: serializedVersion: 6 @@ -15,6 +40,9 @@ AnimatorStateMachine: - serializedVersion: 1 m_State: {fileID: 5154281723833786323} m_Position: {x: 420, y: 210, z: 0} + - serializedVersion: 1 + m_State: {fileID: -439700991718221505} + m_Position: {x: 800, y: -20, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] @@ -124,6 +152,33 @@ BlendTree: m_UseAutomaticThresholds: 1 m_NormalizedBlendValues: 0 m_BlendType: 1 +--- !u!1102 &-439700991718221505 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: WizardFrontIdle + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: -5806975412209012471} + 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: 7400000, guid: 90f3fe0e624b43c44b515016d52dfbae, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: --- !u!91 &9100000 AnimatorController: m_ObjectHideFlags: 0 @@ -151,6 +206,18 @@ AnimatorController: m_DefaultInt: 0 m_DefaultBool: 0 m_Controller: {fileID: 0} + - m_Name: TurnBack + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} + - m_Name: TurnFront + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -172,6 +239,9 @@ AnimatorStateTransition: m_PrefabAsset: {fileID: 0} m_Name: m_Conditions: + - m_ConditionMode: 2 + m_ConditionEvent: TurnFront + m_EventTreshold: 0 - m_ConditionMode: 2 m_ConditionEvent: isRunning m_EventTreshold: 0 @@ -189,6 +259,34 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1101 &3909964258867045483 +AnimatorStateTransition: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: + m_Conditions: + - m_ConditionMode: 2 + m_ConditionEvent: isRunning + m_EventTreshold: 0 + - m_ConditionMode: 1 + m_ConditionEvent: TurnFront + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -439700991718221505} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1102 &5154281723833786323 AnimatorState: serializedVersion: 6 @@ -201,6 +299,7 @@ AnimatorState: m_CycleOffset: 0 m_Transitions: - {fileID: 3234619281913491369} + - {fileID: 3909964258867045483} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 diff --git a/Assets/Scenes/WizardHouse.unity b/Assets/Scenes/WizardHouse.unity index 4243a7c8..e66f189f 100644 --- a/Assets/Scenes/WizardHouse.unity +++ b/Assets/Scenes/WizardHouse.unity @@ -39649,6 +39649,10 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 1393757793} m_Modifications: + - target: {fileID: -7576677615092044163, guid: 417d111e604a8124cb960805d809e513, type: 3} + propertyPath: speed + value: 1.3 + objectReference: {fileID: 0} - target: {fileID: -7576677615092044163, guid: 417d111e604a8124cb960805d809e513, type: 3} propertyPath: isChasing value: 0 diff --git a/Assets/Scripts/NPCs' Scripts/NPCFollowing.cs b/Assets/Scripts/NPCs' Scripts/NPCFollowing.cs index 29030665..22a4199e 100644 --- a/Assets/Scripts/NPCs' Scripts/NPCFollowing.cs +++ b/Assets/Scripts/NPCs' Scripts/NPCFollowing.cs @@ -87,7 +87,16 @@ public class NPCFollowing : MonoBehaviour //start dialogue here gameObject.GetComponent().State = NPCStateEnum.Talking; - anim.SetBool("isRunning", false); + if (targetPosition.position.y > transform.position.y) + { + anim.SetBool("TurnFront",true); + anim.SetBool("isRunning", false); + } + else + { + anim.SetBool("TurnFront",false); + anim.SetBool("isRunning", false); + } agent.path.Clear(); // if we are able to talgk we dont want go go further player } } diff --git a/Assets/Sprites/NPCs/WizardDown.anim b/Assets/Sprites/NPCs/WizardDown.anim index c90c0d62..b741542f 100644 --- a/Assets/Sprites/NPCs/WizardDown.anim +++ b/Assets/Sprites/NPCs/WizardDown.anim @@ -21,15 +21,15 @@ AnimationClip: - curve: - time: 0 value: {fileID: 8686923130848968836, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} - - time: 0.083333336 - value: {fileID: 2429924255151692236, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} - time: 0.16666667 + value: {fileID: 2429924255151692236, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} + - time: 0.33333334 value: {fileID: -1549776866798367382, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} attribute: m_Sprite path: classID: 212 script: {fileID: 0} - m_SampleRate: 12 + m_SampleRate: 6 m_WrapMode: 0 m_Bounds: m_Center: {x: 0, y: 0, z: 0} @@ -52,7 +52,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0.25 + m_StopTime: 0.5 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 diff --git a/Assets/Sprites/NPCs/WizardFrontIdle.anim b/Assets/Sprites/NPCs/WizardFrontIdle.anim new file mode 100644 index 00000000..4ab8da04 --- /dev/null +++ b/Assets/Sprites/NPCs/WizardFrontIdle.anim @@ -0,0 +1,68 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: WizardFrontIdle + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: + - curve: + - time: 0 + value: {fileID: 1425329180273031634, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} + attribute: m_Sprite + path: + classID: 212 + script: {fileID: 0} + m_SampleRate: 12 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + pptrCurveMapping: + - {fileID: 1425329180273031634, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.083333336 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: [] + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Sprites/NPCs/WizardFrontIdle.anim.meta b/Assets/Sprites/NPCs/WizardFrontIdle.anim.meta new file mode 100644 index 00000000..dc0e90c5 --- /dev/null +++ b/Assets/Sprites/NPCs/WizardFrontIdle.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 90f3fe0e624b43c44b515016d52dfbae +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sprites/NPCs/WizardLeft.anim b/Assets/Sprites/NPCs/WizardLeft.anim index 5a612a44..79c20f6e 100644 --- a/Assets/Sprites/NPCs/WizardLeft.anim +++ b/Assets/Sprites/NPCs/WizardLeft.anim @@ -21,15 +21,15 @@ AnimationClip: - curve: - time: 0 value: {fileID: 5831712680124928391, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} - - time: 0.083333336 - value: {fileID: 7058171408329882253, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} - time: 0.16666667 + value: {fileID: 7058171408329882253, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} + - time: 0.33333334 value: {fileID: 5758504133813651979, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} attribute: m_Sprite path: classID: 212 script: {fileID: 0} - m_SampleRate: 12 + m_SampleRate: 6 m_WrapMode: 0 m_Bounds: m_Center: {x: 0, y: 0, z: 0} @@ -52,7 +52,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0.25 + m_StopTime: 0.5 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 diff --git a/Assets/Sprites/NPCs/WizardRight.anim b/Assets/Sprites/NPCs/WizardRight.anim index a4b30ac5..87895982 100644 --- a/Assets/Sprites/NPCs/WizardRight.anim +++ b/Assets/Sprites/NPCs/WizardRight.anim @@ -21,15 +21,15 @@ AnimationClip: - curve: - time: 0 value: {fileID: -6546816321944170997, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} - - time: 0.083333336 - value: {fileID: -2446265752164650608, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} - time: 0.16666667 + value: {fileID: -2446265752164650608, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} + - time: 0.33333334 value: {fileID: -2017559570444700374, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} attribute: m_Sprite path: classID: 212 script: {fileID: 0} - m_SampleRate: 12 + m_SampleRate: 6 m_WrapMode: 0 m_Bounds: m_Center: {x: 0, y: 0, z: 0} @@ -52,7 +52,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0.25 + m_StopTime: 0.5 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 diff --git a/Assets/Sprites/NPCs/WizardUp.anim b/Assets/Sprites/NPCs/WizardUp.anim index dfbdf5d2..1d549cfb 100644 --- a/Assets/Sprites/NPCs/WizardUp.anim +++ b/Assets/Sprites/NPCs/WizardUp.anim @@ -21,15 +21,15 @@ AnimationClip: - curve: - time: 0 value: {fileID: 3351906410715979375, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} - - time: 0.083333336 - value: {fileID: 1425329180273031634, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} - time: 0.16666667 + value: {fileID: 1425329180273031634, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} + - time: 0.33333334 value: {fileID: -2357918661749186383, guid: a618c1a6d5f6e29438eeadfa55fcea33, type: 3} attribute: m_Sprite path: classID: 212 script: {fileID: 0} - m_SampleRate: 12 + m_SampleRate: 6 m_WrapMode: 0 m_Bounds: m_Center: {x: 0, y: 0, z: 0} @@ -52,7 +52,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0.25 + m_StopTime: 0.5 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0