player walk animation
This commit is contained in:
@@ -10,7 +10,8 @@ AnimatorState:
|
|||||||
m_Name: Body_Walk
|
m_Name: Body_Walk
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions: []
|
m_Transitions:
|
||||||
|
- {fileID: -8367213247690784434}
|
||||||
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
|
||||||
@@ -26,6 +27,28 @@ AnimatorState:
|
|||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
m_CycleOffsetParameter:
|
m_CycleOffsetParameter:
|
||||||
m_TimeParameter:
|
m_TimeParameter:
|
||||||
|
--- !u!1101 &-8367213247690784434
|
||||||
|
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: -7806160175022390470}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.6666666
|
||||||
|
m_HasExitTime: 1
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
--- !u!1102 &-7806160175022390470
|
--- !u!1102 &-7806160175022390470
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
@@ -145,7 +168,7 @@ AnimatorStateMachine:
|
|||||||
m_Position: {x: 490, y: 220, z: 0}
|
m_Position: {x: 490, y: 220, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: 5948011480812328800}
|
m_State: {fileID: 5948011480812328800}
|
||||||
m_Position: {x: 600, y: 330, z: 0}
|
m_Position: {x: 500, y: 340, z: 0}
|
||||||
m_ChildStateMachines: []
|
m_ChildStateMachines: []
|
||||||
m_AnyStateTransitions:
|
m_AnyStateTransitions:
|
||||||
- {fileID: 1280296965867937551}
|
- {fileID: 1280296965867937551}
|
||||||
@@ -154,7 +177,7 @@ AnimatorStateMachine:
|
|||||||
m_EntryTransitions: []
|
m_EntryTransitions: []
|
||||||
m_StateMachineTransitions: {}
|
m_StateMachineTransitions: {}
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_AnyStatePosition: {x: 370, y: 340, z: 0}
|
m_AnyStatePosition: {x: 160, y: 400, z: 0}
|
||||||
m_EntryPosition: {x: 90, y: 280, z: 0}
|
m_EntryPosition: {x: 90, y: 280, z: 0}
|
||||||
m_ExitPosition: {x: 420, y: 420, z: 0}
|
m_ExitPosition: {x: 420, y: 420, z: 0}
|
||||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
@@ -186,7 +209,7 @@ AnimatorStateMachine:
|
|||||||
m_ExitPosition: {x: 800, y: 120, z: 0}
|
m_ExitPosition: {x: 800, y: 120, z: 0}
|
||||||
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
|
||||||
m_DefaultState: {fileID: 8401539318113215908}
|
m_DefaultState: {fileID: 8401539318113215908}
|
||||||
--- !u!1101 &-132344648499256047
|
--- !u!1101 &-1748833627154361040
|
||||||
AnimatorStateTransition:
|
AnimatorStateTransition:
|
||||||
m_ObjectHideFlags: 1
|
m_ObjectHideFlags: 1
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
@@ -195,10 +218,10 @@ AnimatorStateTransition:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_Conditions: []
|
m_Conditions: []
|
||||||
m_DstStateMachine: {fileID: 0}
|
m_DstStateMachine: {fileID: 0}
|
||||||
m_DstState: {fileID: 0}
|
m_DstState: {fileID: 8401539318113215908}
|
||||||
m_Solo: 0
|
m_Solo: 0
|
||||||
m_Mute: 0
|
m_Mute: 0
|
||||||
m_IsExit: 1
|
m_IsExit: 0
|
||||||
serializedVersion: 3
|
serializedVersion: 3
|
||||||
m_TransitionDuration: 0.25
|
m_TransitionDuration: 0.25
|
||||||
m_TransitionOffset: 0
|
m_TransitionOffset: 0
|
||||||
@@ -307,6 +330,28 @@ AnimatorStateTransition:
|
|||||||
m_InterruptionSource: 0
|
m_InterruptionSource: 0
|
||||||
m_OrderedInterruption: 1
|
m_OrderedInterruption: 1
|
||||||
m_CanTransitionToSelf: 0
|
m_CanTransitionToSelf: 0
|
||||||
|
--- !u!1101 &5736247422353724224
|
||||||
|
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: -7806160175022390470}
|
||||||
|
m_Solo: 0
|
||||||
|
m_Mute: 0
|
||||||
|
m_IsExit: 0
|
||||||
|
serializedVersion: 3
|
||||||
|
m_TransitionDuration: 0.25
|
||||||
|
m_TransitionOffset: 0
|
||||||
|
m_ExitTime: 0.6666666
|
||||||
|
m_HasExitTime: 1
|
||||||
|
m_HasFixedDuration: 1
|
||||||
|
m_InterruptionSource: 0
|
||||||
|
m_OrderedInterruption: 1
|
||||||
|
m_CanTransitionToSelf: 1
|
||||||
--- !u!1102 &5948011480812328800
|
--- !u!1102 &5948011480812328800
|
||||||
AnimatorState:
|
AnimatorState:
|
||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
@@ -318,7 +363,7 @@ AnimatorState:
|
|||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions:
|
m_Transitions:
|
||||||
- {fileID: -132344648499256047}
|
- {fileID: 5736247422353724224}
|
||||||
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
|
||||||
@@ -395,7 +440,8 @@ AnimatorState:
|
|||||||
m_Name: Legs_Walk
|
m_Name: Legs_Walk
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions: []
|
m_Transitions:
|
||||||
|
- {fileID: -1748833627154361040}
|
||||||
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
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
public class Character : MonoBehaviour
|
public abstract class Character : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
protected Animator _animator;
|
protected Animator _animator;
|
||||||
@@ -65,7 +65,7 @@ public class Character : MonoBehaviour
|
|||||||
FlipCharacter();
|
FlipCharacter();
|
||||||
}
|
}
|
||||||
|
|
||||||
//animator.SetBool("Walk", h_movement != 0);
|
SetWalkingAnimation(h_movement != 0);
|
||||||
|
|
||||||
_isOnLadder = mapElement == MapElementType.Ladder || GetMapElement(Vector2.up) == MapElementType.Ladder;
|
_isOnLadder = mapElement == MapElementType.Ladder || GetMapElement(Vector2.up) == MapElementType.Ladder;
|
||||||
if (_isOnLadder)
|
if (_isOnLadder)
|
||||||
@@ -105,6 +105,7 @@ public class Character : MonoBehaviour
|
|||||||
return MapElementType.Empty;
|
return MapElementType.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract void SetWalkingAnimation(bool isWalking);
|
||||||
|
|
||||||
private void FixedUpdate()
|
private void FixedUpdate()
|
||||||
{
|
{
|
||||||
@@ -119,7 +120,7 @@ public class Character : MonoBehaviour
|
|||||||
if (_isFalling)
|
if (_isFalling)
|
||||||
{
|
{
|
||||||
_body.velocity = new Vector2(0, _body.velocity.y);
|
_body.velocity = new Vector2(0, _body.velocity.y);
|
||||||
//animator.SetBool("Walk", false);
|
SetWalkingAnimation(false);
|
||||||
|
|
||||||
if (GetMapElement(Vector2.down)==MapElementType.Ladder)
|
if (GetMapElement(Vector2.down)==MapElementType.Ladder)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ using UnityEngine;
|
|||||||
|
|
||||||
public class EnemyAI : Character
|
public class EnemyAI : Character
|
||||||
{
|
{
|
||||||
|
protected override void SetWalkingAnimation(bool isWalking)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
float horizontal = 0;
|
float horizontal = 0;
|
||||||
|
|||||||
@@ -87,4 +87,10 @@ public class Player : Character
|
|||||||
_hammer.transform.localScale = new Vector2(_hammer.transform.localScale.x * (_facingRight ? 1 : -1), _hammer.transform.localScale.y);
|
_hammer.transform.localScale = new Vector2(_hammer.transform.localScale.x * (_facingRight ? 1 : -1), _hammer.transform.localScale.y);
|
||||||
_hammer.GetComponent<Rigidbody2D>().velocity = new Vector2(gameObject.transform.localScale.x * _hammerSpeed, 0);
|
_hammer.GetComponent<Rigidbody2D>().velocity = new Vector2(gameObject.transform.localScale.x * _hammerSpeed, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void SetWalkingAnimation(bool isWalking)
|
||||||
|
{
|
||||||
|
_animator.SetBool("Legs_Walk",isWalking);
|
||||||
|
_animator.SetBool("Body_Walk", isWalking);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user