diff --git a/Assets/Fuki + Seiden/seiden-move-airborne.anim b/Assets/Fuki + Seiden/seiden-move-airborne.anim new file mode 100644 index 0000000..59b5877 --- /dev/null +++ b/Assets/Fuki + Seiden/seiden-move-airborne.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: seiden-move-airborne + 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/Assets/Fuki + Seiden/seiden-move-airborne.anim.meta b/Assets/Fuki + Seiden/seiden-move-airborne.anim.meta new file mode 100644 index 0000000..943e85b --- /dev/null +++ b/Assets/Fuki + Seiden/seiden-move-airborne.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b0b1316cf42d54331930284f81512c6d +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scene 1 Assets/Movement.cs b/Assets/Scene 1 Assets/Movement.cs index 8399ce5..161278d 100644 --- a/Assets/Scene 1 Assets/Movement.cs +++ b/Assets/Scene 1 Assets/Movement.cs @@ -15,7 +15,7 @@ public class Movement : MonoBehaviour [SerializeField] private Collider2D m_CrouchDisableCollider; // A collider that will be disabled when crouching const float k_GroundedRadius = .2f; // Radius of the overlap circle to determine if grounded - private bool m_Grounded; // Whether or not the player is grounded. + public bool m_Grounded; // Whether or not the player is grounded. const float k_CeilingRadius = .2f; // Radius of the overlap circle to determine if the player can stand up private Rigidbody2D m_Rigidbody2D; private bool m_FacingRight = true; // For determining which way the player is currently facing. @@ -162,4 +162,3 @@ public class Movement : MonoBehaviour transform.localScale = theScale; } } - diff --git a/Assets/Scene 1 Assets/PlayerMovement.cs b/Assets/Scene 1 Assets/PlayerMovement.cs index 3139879..ed78aa2 100644 --- a/Assets/Scene 1 Assets/PlayerMovement.cs +++ b/Assets/Scene 1 Assets/PlayerMovement.cs @@ -5,7 +5,7 @@ using UnityEngine; public class PlayerMovement : MonoBehaviour { public Movement controller; - //public Animator animator; + public Animator animator; public float runSpeed = 40f; float horizontalMove = 0f; bool jump = false; @@ -13,9 +13,6 @@ public class PlayerMovement : MonoBehaviour // Update is called once per frame void Update() { - // Horizontal value is for the animation state machine. No code required, wow! - //animator.SetFloat("Horizontal", Input.GetAxis("Horizontal")); - horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed; if (Input.GetButtonDown("Jump")) { @@ -27,8 +24,12 @@ public class PlayerMovement : MonoBehaviour } else if (Input.GetKeyUp(KeyCode.LeftShift)) { crouch = false; } - } + if (animator != null) { + animator.SetFloat("Horizontal", Input.GetAxis("Horizontal")); + animator.SetBool("Airborne", !controller.m_Grounded); + } + } void FixedUpdate() { controller.Move(horizontalMove * Time.fixedDeltaTime, crouch, jump); diff --git a/Assets/Scenes/Benji's Scene.unity b/Assets/Scenes/Benji's Scene.unity index 7150d86..9f8b463 100644 --- a/Assets/Scenes/Benji's Scene.unity +++ b/Assets/Scenes/Benji's Scene.unity @@ -257,6 +257,17 @@ Animator: m_HasTransformHierarchy: 1 m_AllowConstantClipSamplingOptimization: 1 m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!114 &264267745 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5439994587591701584, guid: faf72c53445dba543b9e5a89dc76b3e1, type: 3} + m_PrefabInstance: {fileID: 5439994587558609906} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 90da90214d3bb324a8ed8f5b046ba4b9, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &967738952 GameObject: m_ObjectHideFlags: 0 @@ -526,6 +537,11 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 22.02, y: 1} m_EdgeRadius: 0 +--- !u!95 &2140781242 stripped +Animator: + m_CorrespondingSourceObject: {fileID: 5439994586602100319, guid: faf72c53445dba543b9e5a89dc76b3e1, type: 3} + m_PrefabInstance: {fileID: 5439994587558609906} + m_PrefabAsset: {fileID: 0} --- !u!1001 &1517753708608174288 PrefabInstance: m_ObjectHideFlags: 0 @@ -543,7 +559,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1517753707384060330, guid: 87a461560d9a85d45a9200acb45c6ac6, type: 3} propertyPath: m_LocalPosition.x - value: 0 + value: 2 objectReference: {fileID: 0} - target: {fileID: 1517753707384060330, guid: 87a461560d9a85d45a9200acb45c6ac6, type: 3} propertyPath: m_LocalPosition.y @@ -638,5 +654,13 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 5439994587591701612, guid: faf72c53445dba543b9e5a89dc76b3e1, type: 3} + propertyPath: animator + value: + objectReference: {fileID: 2140781242} + - target: {fileID: 5439994587591701612, guid: faf72c53445dba543b9e5a89dc76b3e1, type: 3} + propertyPath: controller + value: + objectReference: {fileID: 264267745} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: faf72c53445dba543b9e5a89dc76b3e1, type: 3}