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 bool _isJumping;
|
||||||
private float _jumpTimer;
|
private float _jumpTimer;
|
||||||
|
|
||||||
|
private RuntimeAnimatorController _idleAnimator;
|
||||||
|
private RuntimeAnimatorController _walkAnimator;
|
||||||
|
private RuntimeAnimatorController _jumpAnimator;
|
||||||
|
|
||||||
public bool isGrounded { get; private set; }
|
public bool isGrounded { get; private set; }
|
||||||
|
|
||||||
public void Construct(IInputService input)
|
public void Construct(IInputService input)
|
||||||
{
|
{
|
||||||
_input = 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()
|
private void Update()
|
||||||
@@ -78,11 +86,17 @@ namespace Code.Gameplay.Player
|
|||||||
var isJumping = !isGrounded;
|
var isJumping = !isGrounded;
|
||||||
|
|
||||||
if (isJumping)
|
if (isJumping)
|
||||||
_animator.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("Animations/penguin_jump_01");
|
{
|
||||||
|
if (_animator.runtimeAnimatorController != _jumpAnimator)
|
||||||
|
_animator.runtimeAnimatorController = _jumpAnimator;
|
||||||
|
}
|
||||||
else if (isMoving)
|
else if (isMoving)
|
||||||
_animator.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("Animations/penguin_walk_01");
|
{
|
||||||
else
|
if (_animator.runtimeAnimatorController != _walkAnimator)
|
||||||
_animator.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("Animations/penguin_idle_01");
|
_animator.runtimeAnimatorController = _walkAnimator;
|
||||||
|
}
|
||||||
|
else if (_animator.runtimeAnimatorController != _idleAnimator)
|
||||||
|
_animator.runtimeAnimatorController = _idleAnimator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckGround()
|
private void CheckGround()
|
||||||
|
|||||||
+5
-5
@@ -21,11 +21,11 @@ AnimationClip:
|
|||||||
- serializedVersion: 2
|
- serializedVersion: 2
|
||||||
curve:
|
curve:
|
||||||
- time: 0
|
- time: 0
|
||||||
value: {fileID: 21300000, guid: d00a97fec0ddfde49bb6a9ae8d67a45b, type: 3}
|
value: {fileID: 21300000, guid: ee1a12069c8273149801819a62088d65, type: 3}
|
||||||
- time: 0.083333336
|
- time: 0.083333336
|
||||||
value: {fileID: 21300000, guid: 371145ea5533f274aa6550d168f1bf4c, type: 3}
|
value: {fileID: 21300000, guid: 371145ea5533f274aa6550d168f1bf4c, type: 3}
|
||||||
- time: 0.16666667
|
- time: 0.16666667
|
||||||
value: {fileID: 21300000, guid: ee1a12069c8273149801819a62088d65, type: 3}
|
value: {fileID: 21300000, guid: d00a97fec0ddfde49bb6a9ae8d67a45b, type: 3}
|
||||||
attribute: m_Sprite
|
attribute: m_Sprite
|
||||||
path:
|
path:
|
||||||
classID: 212
|
classID: 212
|
||||||
@@ -48,9 +48,9 @@ AnimationClip:
|
|||||||
isIntCurve: 0
|
isIntCurve: 0
|
||||||
isSerializeReferenceCurve: 0
|
isSerializeReferenceCurve: 0
|
||||||
pptrCurveMapping:
|
pptrCurveMapping:
|
||||||
- {fileID: 21300000, guid: d00a97fec0ddfde49bb6a9ae8d67a45b, type: 3}
|
|
||||||
- {fileID: 21300000, guid: 371145ea5533f274aa6550d168f1bf4c, type: 3}
|
|
||||||
- {fileID: 21300000, guid: ee1a12069c8273149801819a62088d65, type: 3}
|
- {fileID: 21300000, guid: ee1a12069c8273149801819a62088d65, type: 3}
|
||||||
|
- {fileID: 21300000, guid: 371145ea5533f274aa6550d168f1bf4c, type: 3}
|
||||||
|
- {fileID: 21300000, guid: d00a97fec0ddfde49bb6a9ae8d67a45b, type: 3}
|
||||||
m_AnimationClipSettings:
|
m_AnimationClipSettings:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_AdditiveReferencePoseClip: {fileID: 0}
|
m_AdditiveReferencePoseClip: {fileID: 0}
|
||||||
@@ -61,7 +61,7 @@ AnimationClip:
|
|||||||
m_Level: 0
|
m_Level: 0
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_HasAdditiveReferencePose: 0
|
m_HasAdditiveReferencePose: 0
|
||||||
m_LoopTime: 1
|
m_LoopTime: 0
|
||||||
m_LoopBlend: 0
|
m_LoopBlend: 0
|
||||||
m_LoopBlendOrientation: 0
|
m_LoopBlendOrientation: 0
|
||||||
m_LoopBlendPositionY: 0
|
m_LoopBlendPositionY: 0
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ AnimatorState:
|
|||||||
m_Name: penguin_jump
|
m_Name: penguin_jump
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions:
|
m_Transitions: []
|
||||||
- {fileID: -3647009844017617733}
|
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_Position: {x: 50, y: 50, z: 0}
|
m_Position: {x: 50, y: 50, z: 0}
|
||||||
m_IKOnFeet: 0
|
m_IKOnFeet: 0
|
||||||
@@ -27,28 +26,6 @@ AnimatorState:
|
|||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
m_CycleOffsetParameter:
|
m_CycleOffsetParameter:
|
||||||
m_TimeParameter:
|
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
|
--- !u!91 &9100000
|
||||||
AnimatorController:
|
AnimatorController:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -302,8 +302,8 @@ PlayerSettings:
|
|||||||
m_BuildTargetGraphicsJobMode: []
|
m_BuildTargetGraphicsJobMode: []
|
||||||
m_BuildTargetGraphicsAPIs:
|
m_BuildTargetGraphicsAPIs:
|
||||||
- m_BuildTarget: LinuxStandaloneSupport
|
- m_BuildTarget: LinuxStandaloneSupport
|
||||||
m_APIs: 1500000011000000
|
m_APIs: 1100000015000000
|
||||||
m_Automatic: 0
|
m_Automatic: 1
|
||||||
m_BuildTargetVRSettings: []
|
m_BuildTargetVRSettings: []
|
||||||
m_DefaultShaderChunkSizeInMB: 16
|
m_DefaultShaderChunkSizeInMB: 16
|
||||||
m_DefaultShaderChunkCount: 0
|
m_DefaultShaderChunkCount: 0
|
||||||
|
|||||||
Reference in new issue
Block a user