From 94a871d706c06892dcc4b438a1f0d0805a4db33a Mon Sep 17 00:00:00 2001 From: kimrdd Date: Sat, 3 Feb 2024 10:52:24 +0100 Subject: [PATCH] animation 1 --- .../EnemyAnimations/1/v1/Enemy1.controller | 67 +++++++- ...my1DeathAni.anim => Enemy1v1DeathAni.anim} | 15 +- ...i.anim.meta => Enemy1v1DeathAni.anim.meta} | 0 .../1/v1/Enemy1v1StrangleAni.anim | 160 ++++++++++++++++++ .../1/v1/Enemy1v1StrangleAni.anim.meta | 8 + Assets/Resources/Enemies/Enemy1V1.prefab | 62 +++++-- Assets/Scenes/MovementTest.unity | 82 +++++++++ Assets/Scripts/Enemy/EnemyAnimationHandler.cs | 30 ++++ .../Enemy/EnemyAnimationHandler.cs.meta | 11 ++ 9 files changed, 408 insertions(+), 27 deletions(-) rename Assets/Animations/EnemyAnimations/1/v1/{Enemy1DeathAni.anim => Enemy1v1DeathAni.anim} (92%) rename Assets/Animations/EnemyAnimations/1/v1/{Enemy1DeathAni.anim.meta => Enemy1v1DeathAni.anim.meta} (100%) create mode 100644 Assets/Animations/EnemyAnimations/1/v1/Enemy1v1StrangleAni.anim create mode 100644 Assets/Animations/EnemyAnimations/1/v1/Enemy1v1StrangleAni.anim.meta create mode 100644 Assets/Scripts/Enemy/EnemyAnimationHandler.cs create mode 100644 Assets/Scripts/Enemy/EnemyAnimationHandler.cs.meta diff --git a/Assets/Animations/EnemyAnimations/1/v1/Enemy1.controller b/Assets/Animations/EnemyAnimations/1/v1/Enemy1.controller index 048a508..9012010 100644 --- a/Assets/Animations/EnemyAnimations/1/v1/Enemy1.controller +++ b/Assets/Animations/EnemyAnimations/1/v1/Enemy1.controller @@ -11,7 +11,10 @@ AnimatorStateMachine: m_ChildStates: - serializedVersion: 1 m_State: {fileID: -3618960495364978089} - m_Position: {x: 200, y: 0, z: 0} + m_Position: {x: 400, y: 250, z: 0} + - serializedVersion: 1 + m_State: {fileID: 5449203074349302286} + m_Position: {x: 310, y: 120, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] @@ -21,7 +24,7 @@ AnimatorStateMachine: m_EntryPosition: {x: 50, y: 120, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} - m_DefaultState: {fileID: -3618960495364978089} + m_DefaultState: {fileID: 5449203074349302286} --- !u!1102 &-3618960495364978089 AnimatorState: serializedVersion: 6 @@ -56,7 +59,13 @@ AnimatorController: m_PrefabAsset: {fileID: 0} m_Name: Enemy1 serializedVersion: 5 - m_AnimatorParameters: [] + m_AnimatorParameters: + - m_Name: Die + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -70,3 +79,55 @@ AnimatorController: m_IKPass: 0 m_SyncedLayerAffectsTiming: 0 m_Controller: {fileID: 9100000} +--- !u!1101 &148394794518211540 +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: Die + m_EventTreshold: 0 + m_DstStateMachine: {fileID: 0} + m_DstState: {fileID: -3618960495364978089} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0 + m_HasExitTime: 0 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 +--- !u!1102 &5449203074349302286 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Enemy1v1StrangleAni + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: + - {fileID: 148394794518211540} + 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: e4aa7981bd564914cadd8701d3b2a811, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/Animations/EnemyAnimations/1/v1/Enemy1DeathAni.anim b/Assets/Animations/EnemyAnimations/1/v1/Enemy1v1DeathAni.anim similarity index 92% rename from Assets/Animations/EnemyAnimations/1/v1/Enemy1DeathAni.anim rename to Assets/Animations/EnemyAnimations/1/v1/Enemy1v1DeathAni.anim index 72eb2fb..7466d79 100644 --- a/Assets/Animations/EnemyAnimations/1/v1/Enemy1DeathAni.anim +++ b/Assets/Animations/EnemyAnimations/1/v1/Enemy1v1DeathAni.anim @@ -6,7 +6,7 @@ AnimationClip: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Enemy1DeathAni + m_Name: Enemy1v1DeathAni serializedVersion: 7 m_Legacy: 0 m_Compressed: 0 @@ -20,7 +20,7 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: {x: -19.2, y: 0, z: 0} + value: {x: -0.9, y: 0, z: 0} inSlope: {x: 0, y: 0, z: 0} outSlope: {x: 0, y: 0, z: 0} tangentMode: 0 @@ -37,12 +37,10 @@ AnimationClip: - serializedVersion: 2 curve: - time: 0 - value: {fileID: 21300000, guid: 66152230910b9f64db23853201f5a573, type: 3} - - time: 0.11666667 value: {fileID: 21300000, guid: 9c60022201e9a4a469ca7b14462918ea, type: 3} - - time: 0.21666667 + - time: 0.1 value: {fileID: 21300000, guid: 6b82fc690cf4459419c5f3fd5a691a61, type: 3} - - time: 0.33333334 + - time: 0.21666667 value: {fileID: 21300000, guid: 0cb1db5a033e47d4eba3de86b005ec7f, type: 3} attribute: m_Sprite path: @@ -75,7 +73,6 @@ AnimationClip: isIntCurve: 0 isSerializeReferenceCurve: 0 pptrCurveMapping: - - {fileID: 21300000, guid: 66152230910b9f64db23853201f5a573, type: 3} - {fileID: 21300000, guid: 9c60022201e9a4a469ca7b14462918ea, type: 3} - {fileID: 21300000, guid: 6b82fc690cf4459419c5f3fd5a691a61, type: 3} - {fileID: 21300000, guid: 0cb1db5a033e47d4eba3de86b005ec7f, type: 3} @@ -84,7 +81,7 @@ AnimationClip: m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0.35000002 + m_StopTime: 0.23333333 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 @@ -106,7 +103,7 @@ AnimationClip: m_Curve: - serializedVersion: 3 time: 0 - value: -19.2 + value: -0.9 inSlope: 0 outSlope: 0 tangentMode: 136 diff --git a/Assets/Animations/EnemyAnimations/1/v1/Enemy1DeathAni.anim.meta b/Assets/Animations/EnemyAnimations/1/v1/Enemy1v1DeathAni.anim.meta similarity index 100% rename from Assets/Animations/EnemyAnimations/1/v1/Enemy1DeathAni.anim.meta rename to Assets/Animations/EnemyAnimations/1/v1/Enemy1v1DeathAni.anim.meta diff --git a/Assets/Animations/EnemyAnimations/1/v1/Enemy1v1StrangleAni.anim b/Assets/Animations/EnemyAnimations/1/v1/Enemy1v1StrangleAni.anim new file mode 100644 index 0000000..aaeaf47 --- /dev/null +++ b/Assets/Animations/EnemyAnimations/1/v1/Enemy1v1StrangleAni.anim @@ -0,0 +1,160 @@ +%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: Enemy1v1StrangleAni + serializedVersion: 7 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: -0.9, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: + - serializedVersion: 2 + curve: + - time: 0 + value: {fileID: 21300000, guid: 66152230910b9f64db23853201f5a573, type: 3} + attribute: m_Sprite + path: + classID: 212 + script: {fileID: 0} + flags: 2 + m_SampleRate: 60 + 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 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + - serializedVersion: 2 + path: 0 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + pptrCurveMapping: + - {fileID: 21300000, guid: 66152230910b9f64db23853201f5a573, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.016666668 + 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: + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: -0.9 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: + classID: 4 + script: {fileID: 0} + flags: 0 + - serializedVersion: 2 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: + classID: 4 + script: {fileID: 0} + flags: 0 + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 1 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Animations/EnemyAnimations/1/v1/Enemy1v1StrangleAni.anim.meta b/Assets/Animations/EnemyAnimations/1/v1/Enemy1v1StrangleAni.anim.meta new file mode 100644 index 0000000..ec61a02 --- /dev/null +++ b/Assets/Animations/EnemyAnimations/1/v1/Enemy1v1StrangleAni.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e4aa7981bd564914cadd8701d3b2a811 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/Enemies/Enemy1V1.prefab b/Assets/Resources/Enemies/Enemy1V1.prefab index 0a61874..2035e42 100644 --- a/Assets/Resources/Enemies/Enemy1V1.prefab +++ b/Assets/Resources/Enemies/Enemy1V1.prefab @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &6905705041633878913 +--- !u!1 &658931473633382931 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -8,38 +8,38 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 3920219362688286786} - - component: {fileID: 752169193697258753} - - component: {fileID: 931837291294685723} + - component: {fileID: 3596055233112951220} + - component: {fileID: 8224209185524732719} + - component: {fileID: 7324983754635409392} m_Layer: 0 - m_Name: Enemy1V1 + m_Name: Renderer m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &3920219362688286786 +--- !u!4 &3596055233112951220 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6905705041633878913} + m_GameObject: {fileID: 658931473633382931} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -15.97, y: -0.86, z: 33058.594} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 0} + m_Father: {fileID: 3920219362688286786} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &752169193697258753 +--- !u!212 &8224209185524732719 SpriteRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6905705041633878913} + m_GameObject: {fileID: 658931473633382931} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 @@ -74,25 +74,25 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 21300000, guid: 66152230910b9f64db23853201f5a573, type: 3} + m_Sprite: {fileID: 21300000, guid: 6ec94328ea22672429ca48d1aa458679, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 3.49, y: 2.57} + m_Size: {x: 1.43, y: 2.19} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!95 &931837291294685723 +--- !u!95 &7324983754635409392 Animator: serializedVersion: 5 m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 6905705041633878913} + m_GameObject: {fileID: 658931473633382931} m_Enabled: 1 m_Avatar: {fileID: 0} m_Controller: {fileID: 9100000, guid: 8c057960a463d234daf35d12e970f264, type: 2} @@ -106,3 +106,35 @@ Animator: m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorStateOnDisable: 0 m_WriteDefaultValuesOnDisable: 0 +--- !u!1 &6905705041633878913 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3920219362688286786} + m_Layer: 0 + m_Name: Enemy1V1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3920219362688286786 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6905705041633878913} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.84, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 3596055233112951220} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scenes/MovementTest.unity b/Assets/Scenes/MovementTest.unity index cfaff81..281445b 100644 --- a/Assets/Scenes/MovementTest.unity +++ b/Assets/Scenes/MovementTest.unity @@ -1650,6 +1650,70 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1371458543 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalPosition.x + value: -21.35 + objectReference: {fileID: 0} + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalPosition.y + value: -2.18 + objectReference: {fileID: 0} + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3920219362688286786, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6905705041633878913, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_Name + value: Enemy1V1 + objectReference: {fileID: 0} + - target: {fileID: 7324983754635409392, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + propertyPath: m_Enabled + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 6905705041633878913, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + insertIndex: -1 + addedObject: {fileID: 1642822758} + m_SourcePrefab: {fileID: 100100000, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} --- !u!1 &1420709238 GameObject: m_ObjectHideFlags: 0 @@ -1767,6 +1831,23 @@ Transform: - {fileID: 1316213926} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1642822757 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 6905705041633878913, guid: 8994050caaa5f2c45b56e985a0d0448a, type: 3} + m_PrefabInstance: {fileID: 1371458543} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1642822758 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1642822757} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9fa05ebd2f063df4a8079e013369f78b, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &1666646756 GameObject: m_ObjectHideFlags: 0 @@ -2142,3 +2223,4 @@ SceneRoots: - {fileID: 1365819705} - {fileID: 220016284} - {fileID: 1180110923} + - {fileID: 1371458543} diff --git a/Assets/Scripts/Enemy/EnemyAnimationHandler.cs b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs new file mode 100644 index 0000000..9efa84c --- /dev/null +++ b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class EnemyAnimationHandler : MonoBehaviour +{ + Animator animator; + void Start() + { + animator = GetComponentInChildren(); + if (animator == animator.enabled) + animator.enabled = false; + + } + void Update() + { + if (Input.GetKeyDown(KeyCode.F)) + Strangle(); + if (Input.GetKeyDown(KeyCode.G)) + Die(); + } + public void Strangle() + { + animator.enabled = true; + } + public void Die() + { + animator.SetTrigger("Die"); + } +} diff --git a/Assets/Scripts/Enemy/EnemyAnimationHandler.cs.meta b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs.meta new file mode 100644 index 0000000..3667e28 --- /dev/null +++ b/Assets/Scripts/Enemy/EnemyAnimationHandler.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9fa05ebd2f063df4a8079e013369f78b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: