fixing animations
This commit is contained in:
1 parent
00fbe12dba
commit
bdfb6793e9
4 files changed
+26
-35
No files matched your search
@@ -21,11 +21,19 @@ namespace Code.Gameplay.Player
|
||||
private bool _isJumping;
|
||||
private float _jumpTimer;
|
||||
|
||||
private RuntimeAnimatorController _idleAnimator;
|
||||
private RuntimeAnimatorController _walkAnimator;
|
||||
private RuntimeAnimatorController _jumpAnimator;
|
||||
|
||||
public bool isGrounded { get; private set; }
|
||||
|
||||
public void Construct(IInputService input)
|
||||
{
|
||||
_input = input;
|
||||
_animator.runtimeAnimatorController = null;
|
||||
_idleAnimator = Resources.Load<RuntimeAnimatorController>("Animations/penguin_idle_01");
|
||||
_walkAnimator = Resources.Load<RuntimeAnimatorController>("Animations/penguin_walk_01");
|
||||
_jumpAnimator = Resources.Load<RuntimeAnimatorController>("Animations/penguin_jump_01");
|
||||
}
|
||||
|
||||
private void Update()
|
||||
@@ -78,11 +86,17 @@ namespace Code.Gameplay.Player
|
||||
var isJumping = !isGrounded;
|
||||
|
||||
if (isJumping)
|
||||
_animator.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("Animations/penguin_jump_01");
|
||||
{
|
||||
if (_animator.runtimeAnimatorController != _jumpAnimator)
|
||||
_animator.runtimeAnimatorController = _jumpAnimator;
|
||||
}
|
||||
else if (isMoving)
|
||||
_animator.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("Animations/penguin_walk_01");
|
||||
else
|
||||
_animator.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("Animations/penguin_idle_01");
|
||||
{
|
||||
if (_animator.runtimeAnimatorController != _walkAnimator)
|
||||
_animator.runtimeAnimatorController = _walkAnimator;
|
||||
}
|
||||
else if (_animator.runtimeAnimatorController != _idleAnimator)
|
||||
_animator.runtimeAnimatorController = _idleAnimator;
|
||||
}
|
||||
|
||||
private void CheckGround()
|
||||
|
||||
+5
-5
@@ -21,11 +21,11 @@ AnimationClip:
|
||||
- serializedVersion: 2
|
||||
curve:
|
||||
- time: 0
|
||||
value: {fileID: 21300000, guid: d00a97fec0ddfde49bb6a9ae8d67a45b, type: 3}
|
||||
value: {fileID: 21300000, guid: ee1a12069c8273149801819a62088d65, type: 3}
|
||||
- time: 0.083333336
|
||||
value: {fileID: 21300000, guid: 371145ea5533f274aa6550d168f1bf4c, type: 3}
|
||||
- time: 0.16666667
|
||||
value: {fileID: 21300000, guid: ee1a12069c8273149801819a62088d65, type: 3}
|
||||
value: {fileID: 21300000, guid: d00a97fec0ddfde49bb6a9ae8d67a45b, type: 3}
|
||||
attribute: m_Sprite
|
||||
path:
|
||||
classID: 212
|
||||
@@ -48,9 +48,9 @@ AnimationClip:
|
||||
isIntCurve: 0
|
||||
isSerializeReferenceCurve: 0
|
||||
pptrCurveMapping:
|
||||
- {fileID: 21300000, guid: d00a97fec0ddfde49bb6a9ae8d67a45b, type: 3}
|
||||
- {fileID: 21300000, guid: 371145ea5533f274aa6550d168f1bf4c, type: 3}
|
||||
- {fileID: 21300000, guid: ee1a12069c8273149801819a62088d65, type: 3}
|
||||
- {fileID: 21300000, guid: 371145ea5533f274aa6550d168f1bf4c, type: 3}
|
||||
- {fileID: 21300000, guid: d00a97fec0ddfde49bb6a9ae8d67a45b, type: 3}
|
||||
m_AnimationClipSettings:
|
||||
serializedVersion: 2
|
||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||
@@ -61,7 +61,7 @@ AnimationClip:
|
||||
m_Level: 0
|
||||
m_CycleOffset: 0
|
||||
m_HasAdditiveReferencePose: 0
|
||||
m_LoopTime: 1
|
||||
m_LoopTime: 0
|
||||
m_LoopBlend: 0
|
||||
m_LoopBlendOrientation: 0
|
||||
m_LoopBlendPositionY: 0
|
||||
|
||||
@@ -10,8 +10,7 @@ AnimatorState:
|
||||
m_Name: penguin_jump
|
||||
m_Speed: 1
|
||||
m_CycleOffset: 0
|
||||
m_Transitions:
|
||||
- {fileID: -3647009844017617733}
|
||||
m_Transitions: []
|
||||
m_StateMachineBehaviours: []
|
||||
m_Position: {x: 50, y: 50, z: 0}
|
||||
m_IKOnFeet: 0
|
||||
@@ -27,28 +26,6 @@ AnimatorState:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1101 &-3647009844017617733
|
||||
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: 0}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 1
|
||||
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!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
Reference in new issue
Block a user