Finish my animations

This commit is contained in:
BuyMyMojo 2023-02-26 02:09:56 +11:00
parent 7c0c6eda6a
commit 0859e4b36c
12 changed files with 156 additions and 23 deletions

View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c74438f7d0693d94ab988a019e529d1e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -1,5 +1,30 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1101 &-8942769352569325474
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 1
m_ConditionEvent: IsWalking
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -8110582496927358665}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-8110582496927358665
AnimatorState:
serializedVersion: 6
@ -10,7 +35,8 @@ AnimatorState:
m_Name: Walk
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: -1141462849142485002}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@ -26,6 +52,31 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-1141462849142485002
AnimatorStateTransition:
m_ObjectHideFlags: 1
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name:
m_Conditions:
- m_ConditionMode: 2
m_ConditionEvent: IsWalking
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8537115090425330708}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.14166665
m_TransitionOffset: 0
m_ExitTime: 0.57142866
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
@ -34,7 +85,13 @@ AnimatorController:
m_PrefabAsset: {fileID: 0}
m_Name: MyPlayerAnimator
serializedVersion: 5
m_AnimatorParameters: []
m_AnimatorParameters:
- m_Name: IsWalking
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@ -59,10 +116,10 @@ AnimatorStateMachine:
m_ChildStates:
- serializedVersion: 1
m_State: {fileID: 8537115090425330708}
m_Position: {x: 340, y: 150, z: 0}
m_Position: {x: 270, y: 170, z: 0}
- serializedVersion: 1
m_State: {fileID: -8110582496927358665}
m_Position: {x: 440, y: -110, z: 0}
m_Position: {x: 540, y: 170, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions: []
m_EntryTransitions: []
@ -83,7 +140,8 @@ AnimatorState:
m_Name: Idle
m_Speed: 1
m_CycleOffset: 0
m_Transitions: []
m_Transitions:
- {fileID: -8942769352569325474}
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0

8
Assets/Animations.meta Normal file
View file

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4cc8ef723b2928d45a19519c93a37ccd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -28,7 +28,7 @@ AnimationClip:
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.3
time: 0.16666667
value: {x: 0, y: 1.659, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
@ -37,7 +37,7 @@ AnimationClip:
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.5833333
time: 0.33333334
value: {x: 0, y: 1.521, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
@ -62,7 +62,7 @@ AnimationClip:
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.25
time: 0.15
value: {x: 0, y: 0.771, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
@ -71,7 +71,7 @@ AnimationClip:
inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334}
- serializedVersion: 3
time: 0.5833333
time: 0.33333334
value: {x: 0, y: 0.65, z: 0}
inSlope: {x: 0, y: 0, z: 0}
outSlope: {x: 0, y: 0, z: 0}
@ -117,7 +117,7 @@ AnimationClip:
m_AdditiveReferencePoseClip: {fileID: 0}
m_AdditiveReferencePoseTime: 0
m_StartTime: 0
m_StopTime: 0.5833333
m_StopTime: 0.33333334
m_OrientationOffsetY: 0
m_Level: 0
m_CycleOffset: 0
@ -147,7 +147,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.3
time: 0.16666667
value: 0
inSlope: 0
outSlope: 0
@ -156,7 +156,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5833333
time: 0.33333334
value: 0
inSlope: 0
outSlope: 0
@ -186,7 +186,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.3
time: 0.16666667
value: 1.659
inSlope: 0
outSlope: 0
@ -195,7 +195,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5833333
time: 0.33333334
value: 1.521
inSlope: 0
outSlope: 0
@ -225,7 +225,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.3
time: 0.16666667
value: 0
inSlope: 0
outSlope: 0
@ -234,7 +234,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5833333
time: 0.33333334
value: 0
inSlope: 0
outSlope: 0
@ -264,7 +264,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.25
time: 0.15
value: 0
inSlope: 0
outSlope: 0
@ -273,7 +273,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5833333
time: 0.33333334
value: 0
inSlope: 0
outSlope: 0
@ -303,7 +303,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.25
time: 0.15
value: 0.771
inSlope: 0
outSlope: 0
@ -312,7 +312,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5833333
time: 0.33333334
value: 0.65
inSlope: 0
outSlope: 0
@ -342,7 +342,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.25
time: 0.15
value: 0
inSlope: 0
outSlope: 0
@ -351,7 +351,7 @@ AnimationClip:
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 0.5833333
time: 0.33333334
value: 0
inSlope: 0
outSlope: 0

View file

@ -560,6 +560,10 @@ PrefabInstance:
type: 3}
insertIndex: -1
addedObject: {fileID: 1139635726}
- targetCorrespondingSourceObject: {fileID: 3294758251327466535, guid: 1c5dda3c7cd3cf742afcade5419faeab,
type: 3}
insertIndex: -1
addedObject: {fileID: 1139635727}
m_SourcePrefab: {fileID: 100100000, guid: 1c5dda3c7cd3cf742afcade5419faeab, type: 3}
--- !u!1 &1139635724 stripped
GameObject:
@ -593,6 +597,19 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorStateOnDisable: 0
--- !u!114 &1139635727
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1139635724}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2604af0af2915a4449b6d902e37340ca, type: 3}
m_Name:
m_EditorClassIdentifier:
player: {fileID: 974939167}
--- !u!1 &1228607671
GameObject:
m_ObjectHideFlags: 0

View file

@ -7,6 +7,8 @@ public class Player : MonoBehaviour
[SerializeField] private float moveSpeed = 7f;
private bool isWalking;
private void Update()
{
Vector2 inputVector = new Vector2(0,0);
@ -33,9 +35,15 @@ public class Player : MonoBehaviour
Vector3 moveDir = new Vector3(inputVector.x, 0f, inputVector.y);
transform.position += moveDir * moveSpeed * Time.deltaTime;
float rotateSpeed = 10f;
isWalking = moveDir != Vector3.zero;
float rotateSpeed = 10f;
transform.forward = Vector3.Slerp(transform.forward, moveDir, Time.deltaTime * rotateSpeed);
}
public bool IsWalking()
{
return isWalking;
}
}

View file

@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerAnimator : MonoBehaviour
{
private const string IS_WALKING = "IsWalking";
[SerializeField] private Player player;
private Animator animator;
private void Awake()
{
animator = GetComponent<Animator>();
}
private void Update()
{
animator.SetBool(IS_WALKING, player.IsWalking());
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2604af0af2915a4449b6d902e37340ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: