Working on Jump Animation (in progress)

main
Spencer 4 years ago
parent f9c71ef731
commit 908e78ed4b

@ -6,7 +6,7 @@ AnimationClip:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Protagonist Jump Land v1
m_Name:
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
@ -17,45 +17,21 @@ AnimationClip:
m_PositionCurves: []
m_ScaleCurves: []
m_FloatCurves: []
m_PPtrCurves:
- curve:
- time: 0
value: {fileID: 1540433061672771331, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- time: 0.083333336
value: {fileID: -5324470790269307012, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- time: 0.16666667
value: {fileID: -3023117061024659501, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- time: 0.25
value: {fileID: 5481875011490478117, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
attribute: m_Sprite
path:
classID: 212
script: {fileID: 0}
m_SampleRate: 12
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:
- serializedVersion: 2
path: 0
attribute: 0
script: {fileID: 0}
typeID: 212
customType: 23
isPPtrCurve: 1
pptrCurveMapping:
- {fileID: 1540433061672771331, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- {fileID: -5324470790269307012, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- {fileID: -3023117061024659501, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- {fileID: 5481875011490478117, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
genericBindings: []
pptrCurveMapping: []
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.33333334
m_StopTime: 1
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0

@ -1,74 +0,0 @@
%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: Protagonist Jump Midair v1
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: -472527136499386539, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- time: 0.083333336
value: {fileID: 8667279835780202195, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- time: 0.16666667
value: {fileID: -1355301765853423626, guid: c8e2cf18de8fd7742b48c17d509d358c, 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: -472527136499386539, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- {fileID: 8667279835780202195, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- {fileID: -1355301765853423626, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.25
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: []

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7017e4bf141d99e4e80e0efcc98e51fa
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000
userData:
assetBundleName:
assetBundleVariant:

@ -6,7 +6,7 @@ AnimationClip:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Protagonist Jump Takeoff v1
m_Name: Protagonist Jump v1
serializedVersion: 6
m_Legacy: 0
m_Compressed: 0
@ -27,6 +27,10 @@ AnimationClip:
value: {fileID: -1442490000430059858, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- time: 0.25
value: {fileID: -7868241686654605716, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- time: 0.33333334
value: {fileID: -472527136499386539, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- time: 0.41666666
value: {fileID: 8667279835780202195, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
attribute: m_Sprite
path:
classID: 212
@ -50,12 +54,14 @@ AnimationClip:
- {fileID: 429644503569667005, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- {fileID: -1442490000430059858, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- {fileID: -7868241686654605716, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- {fileID: -472527136499386539, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
- {fileID: 8667279835780202195, guid: c8e2cf18de8fd7742b48c17d509d358c, type: 3}
m_AnimationClipSettings:
serializedVersion: 2
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.33333334
m_StopTime: 0.5
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 11654141f921fec419f6b14b1fc80a29
guid: 56c62be1789ab084f90a106333e715dd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 7400000

@ -73,11 +73,11 @@ AnimatorState:
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Takeoff
m_Name: Jump
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -8501373588511834804}
- {fileID: -3874732199687805077}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@ -115,6 +115,28 @@ AnimatorStateTransition:
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-3874732199687805077
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: 3480931448333261977}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.25
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1107 &-121783143131200048
AnimatorStateMachine:
serializedVersion: 6
@ -132,13 +154,10 @@ AnimatorStateMachine:
m_Position: {x: 80, y: 160, z: 0}
- serializedVersion: 1
m_State: {fileID: -7548201986605107798}
m_Position: {x: 420, y: 200, z: 0}
- serializedVersion: 1
m_State: {fileID: 8064295483439524213}
m_Position: {x: 420, y: 110, z: 0}
m_Position: {x: 350, y: 160, z: 0}
- serializedVersion: 1
m_State: {fileID: 3480931448333261977}
m_Position: {x: 420, y: 30, z: 0}
m_Position: {x: 350, y: 70, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
@ -163,7 +182,19 @@ AnimatorController:
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
- m_Name: velocityY
m_Type: 1
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
- m_Name: isGrounded
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer

@ -18,6 +18,7 @@ public class movement : MonoBehaviour
public float _MinAcc = -1.0f;
public float _Deceleration = 2f;
public float jumpForce = 350;
private bool isGrounded;
// Start is called before the first frame update
void Start()
@ -37,6 +38,7 @@ public class movement : MonoBehaviour
horizontal = Input.GetAxisRaw("Horizontal");
vertical = Input.GetAxisRaw("Vertical");
animator.SetFloat("horizontal", horizontal);
if (horizontal < 0)
{
@ -73,6 +75,7 @@ public class movement : MonoBehaviour
rb2d.AddForce(new Vector2(0, jumpForce));
jumping = true;
}
JumpAnimation();
}
private void acceleration()
@ -119,4 +122,18 @@ public class movement : MonoBehaviour
{
jumping = false;
}
private void JumpAnimation()
{
if (!isGrounded)
{
animator.SetBool("isGrounded", false);
animator.SetFloat("velocityY", 1 * Mathf.Sign(rb2d.velocity.y));
}
if (isGrounded)
{
animator.SetBool("isGrounded", true);
animator.SetFloat("velocityY", 0);
}
}
}

Loading…
Cancel
Save