From aefa408e1130489d9359f83e785ad037a7633b46 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 3 Jan 2023 15:04:03 -0500 Subject: [PATCH] flap --- unity/Assets/Scenes/SampleScene.unity | 2 +- unity/Assets/Scripts/DragonMovement.cs | 4 +- .../babydragon_sheets/Dragon_Red.controller | 89 ++++++++++++++++++- .../Assets/Sprites/babydragon_sheets/fly.anim | 32 +++---- .../Sprites/babydragon_sheets/glide.anim | 68 ++++++++++++++ .../Sprites/babydragon_sheets/glide.anim.meta | 8 ++ .../Sprites/babydragon_sheets/shoot.anim | 53 +++++++++++ .../Sprites/babydragon_sheets/shoot.anim.meta | 8 ++ 8 files changed, 242 insertions(+), 22 deletions(-) create mode 100644 unity/Assets/Sprites/babydragon_sheets/glide.anim create mode 100644 unity/Assets/Sprites/babydragon_sheets/glide.anim.meta create mode 100644 unity/Assets/Sprites/babydragon_sheets/shoot.anim create mode 100644 unity/Assets/Sprites/babydragon_sheets/shoot.anim.meta diff --git a/unity/Assets/Scenes/SampleScene.unity b/unity/Assets/Scenes/SampleScene.unity index 4d97198..6406e7a 100644 --- a/unity/Assets/Scenes/SampleScene.unity +++ b/unity/Assets/Scenes/SampleScene.unity @@ -242,7 +242,7 @@ SpriteRenderer: m_SortingLayerID: 0 m_SortingLayer: 0 m_SortingOrder: 0 - m_Sprite: {fileID: 4111647035729452617, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + m_Sprite: {fileID: 4601113484269595429, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 diff --git a/unity/Assets/Scripts/DragonMovement.cs b/unity/Assets/Scripts/DragonMovement.cs index b6ed4cd..633593e 100644 --- a/unity/Assets/Scripts/DragonMovement.cs +++ b/unity/Assets/Scripts/DragonMovement.cs @@ -9,7 +9,7 @@ public class DragonMovement : MonoBehaviour float _flapTime = 0f; [SerializeField] float FlapForce = 300f; [SerializeField] float FlapLength = .25f; - + Animator _animator; bool _inCloud; @@ -26,6 +26,7 @@ public class DragonMovement : MonoBehaviour void Start() { _rigidbody = this.GetComponent(); + _animator = this.GetComponent(); } private void Update() @@ -33,6 +34,7 @@ public class DragonMovement : MonoBehaviour if (Input.GetKeyDown(FlapKey)) { _flapTime = FlapLength; + _animator.Play("fly"); } } diff --git a/unity/Assets/Sprites/babydragon_sheets/Dragon_Red.controller b/unity/Assets/Sprites/babydragon_sheets/Dragon_Red.controller index 40cb326..4b4534a 100644 --- a/unity/Assets/Sprites/babydragon_sheets/Dragon_Red.controller +++ b/unity/Assets/Sprites/babydragon_sheets/Dragon_Red.controller @@ -1,5 +1,53 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-4560172163980586792 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: glide + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + 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: fbf21fd349a09274a8d97216541dd6f2, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!1101 &-3812328723082327589 +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: -4560172163980586792} + m_Solo: 0 + m_Mute: 0 + m_IsExit: 0 + serializedVersion: 3 + m_TransitionDuration: 0.25 + m_TransitionOffset: 0 + m_ExitTime: 0.57142854 + m_HasExitTime: 1 + m_HasFixedDuration: 1 + m_InterruptionSource: 0 + m_OrderedInterruption: 1 + m_CanTransitionToSelf: 1 --- !u!1102 &-465064992474642624 AnimatorState: serializedVersion: 6 @@ -10,7 +58,8 @@ AnimatorState: m_Name: fly m_Speed: 1 m_CycleOffset: 0 - m_Transitions: [] + m_Transitions: + - {fileID: -3812328723082327589} m_StateMachineBehaviours: [] m_Position: {x: 50, y: 50, z: 0} m_IKOnFeet: 0 @@ -37,17 +86,23 @@ AnimatorStateMachine: m_ChildStates: - serializedVersion: 1 m_State: {fileID: -465064992474642624} - m_Position: {x: 200, y: 0, z: 0} + m_Position: {x: 450, y: 0, z: 0} + - serializedVersion: 1 + m_State: {fileID: -4560172163980586792} + m_Position: {x: 360, y: 250, z: 0} + - serializedVersion: 1 + m_State: {fileID: 5088002357541956511} + m_Position: {x: 270, y: 130, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] m_StateMachineTransitions: {} m_StateMachineBehaviours: [] m_AnyStatePosition: {x: 50, y: 20, z: 0} - m_EntryPosition: {x: 50, y: 120, z: 0} + m_EntryPosition: {x: 60, y: 180, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} - m_DefaultState: {fileID: -465064992474642624} + m_DefaultState: {fileID: -4560172163980586792} --- !u!91 &9100000 AnimatorController: m_ObjectHideFlags: 0 @@ -70,3 +125,29 @@ AnimatorController: m_IKPass: 0 m_SyncedLayerAffectsTiming: 0 m_Controller: {fileID: 9100000} +--- !u!1102 &5088002357541956511 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: shoot + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + 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: 2f2ae815d640101418aa3aa0732c3691, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/unity/Assets/Sprites/babydragon_sheets/fly.anim b/unity/Assets/Sprites/babydragon_sheets/fly.anim index 14c33e2..663d0af 100644 --- a/unity/Assets/Sprites/babydragon_sheets/fly.anim +++ b/unity/Assets/Sprites/babydragon_sheets/fly.anim @@ -20,21 +20,21 @@ AnimationClip: m_PPtrCurves: - curve: - time: 0 - value: {fileID: 4601113484269595429, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - time: 0.06666667 - value: {fileID: -4225241236211196724, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - time: 0.15 - value: {fileID: -8250586819289983490, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - time: 0.23333333 - value: {fileID: -2839695678403271104, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - time: 0.31666666 value: {fileID: 3947601404920457750, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - time: 0.4 + - time: 0.05 value: {fileID: -3632370436216186304, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - time: 0.48333332 + - time: 0.1 value: {fileID: 6619212068875895600, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - time: 0.56666666 + - time: 0.15 value: {fileID: 529423214910536459, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + - time: 0.2 + value: {fileID: -8250586819289983490, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + - time: 0.25 + value: {fileID: -4225241236211196724, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + - time: 0.3 + value: {fileID: 4601113484269595429, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + - time: 0.33333334 + value: {fileID: 4601113484269595429, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} attribute: m_Sprite path: classID: 212 @@ -54,20 +54,20 @@ AnimationClip: customType: 23 isPPtrCurve: 1 pptrCurveMapping: - - {fileID: 4601113484269595429, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - {fileID: -4225241236211196724, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - {fileID: -8250586819289983490, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - - {fileID: -2839695678403271104, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - {fileID: 3947601404920457750, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - {fileID: -3632370436216186304, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - {fileID: 6619212068875895600, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} - {fileID: 529423214910536459, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + - {fileID: -8250586819289983490, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + - {fileID: -4225241236211196724, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + - {fileID: 4601113484269595429, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + - {fileID: 4601113484269595429, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} m_AnimationClipSettings: serializedVersion: 2 m_AdditiveReferencePoseClip: {fileID: 0} m_AdditiveReferencePoseTime: 0 m_StartTime: 0 - m_StopTime: 0.5833333 + m_StopTime: 0.35000002 m_OrientationOffsetY: 0 m_Level: 0 m_CycleOffset: 0 diff --git a/unity/Assets/Sprites/babydragon_sheets/glide.anim b/unity/Assets/Sprites/babydragon_sheets/glide.anim new file mode 100644 index 0000000..ac016a7 --- /dev/null +++ b/unity/Assets/Sprites/babydragon_sheets/glide.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: glide + 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: 529423214910536459, guid: a0e17cad4342ba34eb84f9fd99fad50a, type: 3} + attribute: m_Sprite + path: + classID: 212 + script: {fileID: 0} + 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 + pptrCurveMapping: + - {fileID: 529423214910536459, guid: a0e17cad4342ba34eb84f9fd99fad50a, 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: 1 + 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/unity/Assets/Sprites/babydragon_sheets/glide.anim.meta b/unity/Assets/Sprites/babydragon_sheets/glide.anim.meta new file mode 100644 index 0000000..bbf02b0 --- /dev/null +++ b/unity/Assets/Sprites/babydragon_sheets/glide.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fbf21fd349a09274a8d97216541dd6f2 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/unity/Assets/Sprites/babydragon_sheets/shoot.anim b/unity/Assets/Sprites/babydragon_sheets/shoot.anim new file mode 100644 index 0000000..b9b04fd --- /dev/null +++ b/unity/Assets/Sprites/babydragon_sheets/shoot.anim @@ -0,0 +1,53 @@ +%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: shoot + 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: [] + 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: [] + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + 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/unity/Assets/Sprites/babydragon_sheets/shoot.anim.meta b/unity/Assets/Sprites/babydragon_sheets/shoot.anim.meta new file mode 100644 index 0000000..58fd338 --- /dev/null +++ b/unity/Assets/Sprites/babydragon_sheets/shoot.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2f2ae815d640101418aa3aa0732c3691 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: