몬스터 애니메이션 방식 변경

This commit is contained in:
Mingu Kim
2025-02-10 23:06:49 +09:00
parent 25daa43309
commit df31df7d40
7 changed files with 100 additions and 202 deletions

View File

@@ -36,8 +36,7 @@ AnimatorState:
m_Name: Walk
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 5118717445711135838}
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -53,31 +52,6 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-2104665456298266282
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: Walk
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -2826469442554405870}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.673913
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1102 &-206161041863570739
AnimatorState:
serializedVersion: 6
@@ -190,56 +164,6 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &5118717445711135838
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: Walk
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8974360202922242318}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.42307693
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &5247037302422454140
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: Attack
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 8693684011770968853}
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: 0
--- !u!1102 &8693684011770968853
AnimatorState:
serializedVersion: 6
@@ -276,8 +200,7 @@ AnimatorState:
m_Name: Idle
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -2104665456298266282}
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -324,8 +247,7 @@ AnimatorStateMachine:
m_State: {fileID: -206161041863570739}
m_Position: {x: 570, y: 420, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions:
- {fileID: 5247037302422454140}
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []

View File

@@ -17,10 +17,9 @@ AnimatorStateMachine:
m_Position: {x: 570, y: 110, z: 0}
- serializedVersion: 1
m_State: {fileID: -6655501467506089146}
m_Position: {x: 320, y: 20, z: 0}
m_Position: {x: 460, y: 20, z: 0}
m_ChildStateMachines: []
m_AnyStateTransitions:
- {fileID: 5818298720468040081}
m_AnyStateTransitions: []
m_EntryTransitions: []
m_StateMachineTransitions: {}
m_StateMachineBehaviours: []
@@ -39,8 +38,7 @@ AnimatorState:
m_Name: Idle
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -3472015035896594382}
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -66,8 +64,7 @@ AnimatorState:
m_Name: Attack
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: -5713359683907962938}
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -83,56 +80,6 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &-5713359683907962938
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: Walk
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -6701309803678357875}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0.25
m_TransitionOffset: 0
m_ExitTime: 0.5
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &-3472015035896594382
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: Walk
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: 1882972568344343729}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!91 &9100000
AnimatorController:
m_ObjectHideFlags: 0
@@ -154,6 +101,12 @@ AnimatorController:
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
- m_Name: Idle
m_Type: 4
m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer
@@ -177,8 +130,7 @@ AnimatorState:
m_Name: Walk
m_Speed: 1
m_CycleOffset: 0
m_Transitions:
- {fileID: 5575444626708920409}
m_Transitions: []
m_StateMachineBehaviours: []
m_Position: {x: 50, y: 50, z: 0}
m_IKOnFeet: 0
@@ -194,53 +146,3 @@ AnimatorState:
m_MirrorParameter:
m_CycleOffsetParameter:
m_TimeParameter:
--- !u!1101 &5575444626708920409
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: Walk
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -6701309803678357875}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.5
m_HasExitTime: 0
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 1
--- !u!1101 &5818298720468040081
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: Attack
m_EventTreshold: 0
m_DstStateMachine: {fileID: 0}
m_DstState: {fileID: -6655501467506089146}
m_Solo: 0
m_Mute: 0
m_IsExit: 0
serializedVersion: 3
m_TransitionDuration: 0
m_TransitionOffset: 0
m_ExitTime: 0.75
m_HasExitTime: 1
m_HasFixedDuration: 1
m_InterruptionSource: 0
m_OrderedInterruption: 1
m_CanTransitionToSelf: 0

View File

@@ -22352,7 +22352,7 @@ Animator:
m_GameObject: {fileID: 585265462}
m_Enabled: 1
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: fcd7ead41abcd7f458edb6a3cdfdd564, type: 2}
m_Controller: {fileID: 22100000, guid: 651e27074ab33cf47886fbe008de917d, type: 2}
m_CullingMode: 0
m_UpdateMode: 0
m_ApplyRootMotion: 0
@@ -75231,6 +75231,63 @@ Sprite:
m_PhysicsShape: []
m_Bones: []
m_SpriteID:
--- !u!1001 &2131259786
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1762751622269960499, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_Name
value: SpriteEffect
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalPosition.x
value: -4
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1762751622269960500, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c28b253474f28e54ebeca15f342c2482, type: 3}
--- !u!114 &2132150059
MonoBehaviour:
m_ObjectHideFlags: 0
@@ -76075,3 +76132,4 @@ SceneRoots:
- {fileID: 1494770074}
- {fileID: 957750499}
- {fileID: 585265470}
- {fileID: 2131259786}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Numerics;
@@ -45,6 +46,13 @@ namespace TON
private Collider2D _collider;
public float defencePower;
// 애니메이션 관련 선언들
private string currentState;
const string AniIdle = "Idle";
const string AniWalk = "Walk";
const string AniAttack = "Attack";
public bool IsWalking
{
@@ -96,6 +104,13 @@ namespace TON
defencePower = 10f;
}
void ChangeAnimationState(string newState)
{
if(currentState == newState) return;
_animator.Play(newState);
}
private void ReadCSV()
{
TextAsset csvFile = Resources.Load<TextAsset>("Monster");
@@ -153,10 +168,11 @@ namespace TON
{
// walking 상태에서 walkingTime을 초과할 경우 idle 애니메이션 재생
transform.Translate(_direction * speed * Time.deltaTime);
if (Time.realtimeSinceStartup - _currentTime >= walkingTime)
{
_isWalking = false;
ChangeAnimationState(AniIdle);
_currentTime = Time.realtimeSinceStartup;
}
}
@@ -175,11 +191,13 @@ namespace TON
}
_isWalking = true;
ChangeAnimationState(AniWalk);
}
}
// 걷기 애니메이션으로 변경
_animator.SetBool("Walk", _isWalking); // 걷기 애니메이션
// ChangeAnimationState(AniWalk);
// _animator.SetBool("Walk", _isWalking); // 걷기 애니메이션
}
public void ApplyDamage(float damage)
@@ -205,6 +223,8 @@ namespace TON
public void Attack(GameObject player)
{
ChangeAnimationState(AniAttack);
// _animator.Play("Attack");
_animator.SetTrigger("Attack");
// 임시 반영 수정 예정
DamageCalculator damageCalculator = new DamageCalculator();

View File

@@ -32,7 +32,6 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8589673606415132978}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@@ -131,7 +130,6 @@ RectTransform:
- {fileID: 8589673606200230253}
- {fileID: 8589673608165470554}
m_Father: {fileID: 8589673608144055963}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0}
m_AnchorMax: {x: 0.5, y: 0}
@@ -265,7 +263,6 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8589673608144055963}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
@@ -364,7 +361,6 @@ RectTransform:
- {fileID: 8589673607930580844}
- {fileID: 8589673606415132978}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
@@ -390,6 +386,7 @@ Canvas:
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
@@ -432,7 +429,7 @@ MonoBehaviour:
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 127
--- !u!1 &8589673608165470555
GameObject:
m_ObjectHideFlags: 0
@@ -465,7 +462,6 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8589673606415132978}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}