From 1a6d7875f6ff2bb152cdd81c7b6d341ec255869b Mon Sep 17 00:00:00 2001 From: Marro64 Date: Thu, 18 Jun 2026 21:58:42 +0200 Subject: [PATCH] Animation refactor mostly done --- Assets/Animations/Ghost/Ghost.controller | 280 ++++++++-------- Assets/Animations/PacMan/PacMan.controller | 305 +++++++----------- .../Animations/PacMan/PacManStoppedDown.anim | 72 +++++ .../PacMan/PacManStoppedDown.anim.meta | 8 + .../Animations/PacMan/PacManStoppedLeft.anim | 72 +++++ .../PacMan/PacManStoppedLeft.anim.meta | 8 + .../Animations/PacMan/PacManStoppedRight.anim | 72 +++++ .../PacMan/PacManStoppedRight.anim.meta | 8 + Assets/Animations/PacMan/PacManStoppedUp.anim | 72 +++++ .../PacMan/PacManStoppedUp.anim.meta | 8 + Assets/Scenes/PacMan.unity | 30 +- Assets/Scripts/Ghost.asset | 116 ++++++- Assets/Scripts/Ghost.cs | 84 ++--- Assets/Scripts/PacMan.asset | 98 +++++- Assets/Scripts/PacMan.cs | 65 ++-- 15 files changed, 852 insertions(+), 446 deletions(-) create mode 100644 Assets/Animations/PacMan/PacManStoppedDown.anim create mode 100644 Assets/Animations/PacMan/PacManStoppedDown.anim.meta create mode 100644 Assets/Animations/PacMan/PacManStoppedLeft.anim create mode 100644 Assets/Animations/PacMan/PacManStoppedLeft.anim.meta create mode 100644 Assets/Animations/PacMan/PacManStoppedRight.anim create mode 100644 Assets/Animations/PacMan/PacManStoppedRight.anim.meta create mode 100644 Assets/Animations/PacMan/PacManStoppedUp.anim create mode 100644 Assets/Animations/PacMan/PacManStoppedUp.anim.meta diff --git a/Assets/Animations/Ghost/Ghost.controller b/Assets/Animations/Ghost/Ghost.controller index 6418f82..e8f9a65 100644 --- a/Assets/Animations/Ghost/Ghost.controller +++ b/Assets/Animations/Ghost/Ghost.controller @@ -8,25 +8,9 @@ BlendTree: m_PrefabAsset: {fileID: 0} m_Name: Caught m_Childs: - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: b7fa9ace8554cea4f9fb60fd49d46003, type: 2} - m_Threshold: 0 - m_Position: {x: 1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostType - m_Mirror: 0 - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: e78691864c89f71408d1c60387bfbb68, type: 2} - m_Threshold: 0.33333334 - m_Position: {x: -1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostType - m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: 36b0773acb645d54386957b2ee95b9ae, type: 2} - m_Threshold: 0.6666667 + m_Threshold: 1 m_Position: {x: 0, y: 1} m_TimeScale: 1 m_CycleOffset: 0 @@ -34,19 +18,35 @@ BlendTree: m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: f0e74ae0e0fa68941a3801f395aae18e, type: 2} - m_Threshold: 1 + m_Threshold: 2 m_Position: {x: 0, y: -1} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: GhostType m_Mirror: 0 - m_BlendParameter: DirX + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: e78691864c89f71408d1c60387bfbb68, type: 2} + m_Threshold: 4 + m_Position: {x: -1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostType + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: b7fa9ace8554cea4f9fb60fd49d46003, type: 2} + m_Threshold: 8 + m_Position: {x: 1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostType + m_Mirror: 0 + m_BlendParameter: Direction m_BlendParameterY: DirY - m_MinThreshold: 0 - m_MaxThreshold: 1 - m_UseAutomaticThresholds: 1 + m_MinThreshold: 1 + m_MaxThreshold: 8 + m_UseAutomaticThresholds: 0 m_NormalizedBlendValues: 0 - m_BlendType: 1 + m_BlendType: 0 --- !u!206 &-8944447067464121002 BlendTree: m_ObjectHideFlags: 1 @@ -56,24 +56,16 @@ BlendTree: m_Name: Special m_Childs: - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: 7285e9dfd47eeb64f8a359c3d14be984, type: 2} + m_Motion: {fileID: 7400000, guid: 2e01a9fa01711c949a6922e3ebaece0f, type: 2} m_Threshold: 0 - m_Position: {x: 1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: DirX - m_Mirror: 0 - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: aaf4617f2ca36da40883d1c0fa350dbc, type: 2} - m_Threshold: 0.25 - m_Position: {x: -1, y: 0} + m_Position: {x: 0, y: 0} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: DirX m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: 85bb4d19537fb1d429f9b123bc9d9c00, type: 2} - m_Threshold: 0.5 + m_Threshold: 1 m_Position: {x: 0, y: 1} m_TimeScale: 1 m_CycleOffset: 0 @@ -81,27 +73,35 @@ BlendTree: m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: 454d1764e1b7a1946808d4221d71c6c5, type: 2} - m_Threshold: 0.75 + m_Threshold: 2 m_Position: {x: 0, y: -1} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: DirX m_Mirror: 0 - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: 2e01a9fa01711c949a6922e3ebaece0f, type: 2} - m_Threshold: 1 - m_Position: {x: 0, y: 0} + m_Motion: {fileID: 7400000, guid: aaf4617f2ca36da40883d1c0fa350dbc, type: 2} + m_Threshold: 4 + m_Position: {x: -1, y: 0} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: DirX m_Mirror: 0 - m_BlendParameter: DirX + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 7285e9dfd47eeb64f8a359c3d14be984, type: 2} + m_Threshold: 8 + m_Position: {x: 1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: DirX + m_Mirror: 0 + m_BlendParameter: Direction m_BlendParameterY: DirY m_MinThreshold: 0 - m_MaxThreshold: 1 - m_UseAutomaticThresholds: 1 + m_MaxThreshold: 8 + m_UseAutomaticThresholds: 0 m_NormalizedBlendValues: 0 - m_BlendType: 1 + m_BlendType: 0 --- !u!206 &-6725170829935541210 BlendTree: m_ObjectHideFlags: 1 @@ -110,25 +110,9 @@ BlendTree: m_PrefabAsset: {fileID: 0} m_Name: Inky m_Childs: - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: 802f1a2ffb945bd4ba7c70c31c7399e1, type: 2} - m_Threshold: 0 - m_Position: {x: 1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostType - m_Mirror: 0 - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: ce5667efe0f28ad4ba4ac1430a737dab, type: 2} - m_Threshold: 0.33333334 - m_Position: {x: -1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostType - m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: 9894cddcecedab845ae42c087acf40a8, type: 2} - m_Threshold: 0.6666667 + m_Threshold: 1 m_Position: {x: 0, y: 1} m_TimeScale: 1 m_CycleOffset: 0 @@ -136,19 +120,35 @@ BlendTree: m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: 3df116c3435334949a1acad965ecba8b, type: 2} - m_Threshold: 1 + m_Threshold: 2 m_Position: {x: 0, y: -1} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: GhostType m_Mirror: 0 - m_BlendParameter: DirX + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: ce5667efe0f28ad4ba4ac1430a737dab, type: 2} + m_Threshold: 4 + m_Position: {x: -1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostType + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 802f1a2ffb945bd4ba7c70c31c7399e1, type: 2} + m_Threshold: 8 + m_Position: {x: 1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostType + m_Mirror: 0 + m_BlendParameter: Direction m_BlendParameterY: DirY - m_MinThreshold: 0 - m_MaxThreshold: 1 - m_UseAutomaticThresholds: 1 + m_MinThreshold: 1 + m_MaxThreshold: 8 + m_UseAutomaticThresholds: 0 m_NormalizedBlendValues: 0 - m_BlendType: 1 + m_BlendType: 0 --- !u!1102 &-5396122242781941074 AnimatorState: serializedVersion: 6 @@ -183,25 +183,9 @@ BlendTree: m_PrefabAsset: {fileID: 0} m_Name: Blinky m_Childs: - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: 456e9eb70ceaf434186cbc77f60bcd68, type: 2} - m_Threshold: 0 - m_Position: {x: 1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostState - m_Mirror: 0 - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: de276d8cc3b87d540aaa3406ce645c2f, type: 2} - m_Threshold: 0.33333334 - m_Position: {x: -1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostState - m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: 33a8bfdc4f32c8c48a25e7ced8ea7816, type: 2} - m_Threshold: 0.6666667 + m_Threshold: 1 m_Position: {x: 0, y: 1} m_TimeScale: 1 m_CycleOffset: 0 @@ -209,19 +193,35 @@ BlendTree: m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: d3a6c5069daf7f842919751122a63959, type: 2} - m_Threshold: 1 + m_Threshold: 2 m_Position: {x: 0, y: -1} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: GhostState m_Mirror: 0 - m_BlendParameter: DirX + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: de276d8cc3b87d540aaa3406ce645c2f, type: 2} + m_Threshold: 4 + m_Position: {x: -1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostState + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 456e9eb70ceaf434186cbc77f60bcd68, type: 2} + m_Threshold: 8 + m_Position: {x: 1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostState + m_Mirror: 0 + m_BlendParameter: Direction m_BlendParameterY: DirY - m_MinThreshold: 0 - m_MaxThreshold: 1 - m_UseAutomaticThresholds: 1 + m_MinThreshold: 1 + m_MaxThreshold: 8 + m_UseAutomaticThresholds: 0 m_NormalizedBlendValues: 0 - m_BlendType: 1 + m_BlendType: 0 --- !u!206 &-994243735496022530 BlendTree: m_ObjectHideFlags: 1 @@ -230,25 +230,9 @@ BlendTree: m_PrefabAsset: {fileID: 0} m_Name: Clyde m_Childs: - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: c3139552050fc45418fb2068d756cf5b, type: 2} - m_Threshold: 0 - m_Position: {x: 1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostType - m_Mirror: 0 - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: 2e17027ea2c6d3643aaf6a75315d1171, type: 2} - m_Threshold: 0.33333334 - m_Position: {x: -1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostType - m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: e9f01727f466f0f4983d7e48a06427a7, type: 2} - m_Threshold: 0.6666667 + m_Threshold: 1 m_Position: {x: 0, y: 1} m_TimeScale: 1 m_CycleOffset: 0 @@ -256,19 +240,35 @@ BlendTree: m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: 6d653efb9a144174babda398c7b00b8c, type: 2} - m_Threshold: 1 + m_Threshold: 2 m_Position: {x: 0, y: -1} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: GhostType m_Mirror: 0 - m_BlendParameter: DirX + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 2e17027ea2c6d3643aaf6a75315d1171, type: 2} + m_Threshold: 4 + m_Position: {x: -1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostType + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: c3139552050fc45418fb2068d756cf5b, type: 2} + m_Threshold: 8 + m_Position: {x: 1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostType + m_Mirror: 0 + m_BlendParameter: Direction m_BlendParameterY: DirY - m_MinThreshold: 0 - m_MaxThreshold: 1 - m_UseAutomaticThresholds: 1 + m_MinThreshold: 1 + m_MaxThreshold: 8 + m_UseAutomaticThresholds: 0 m_NormalizedBlendValues: 0 - m_BlendType: 1 + m_BlendType: 0 --- !u!91 &9100000 AnimatorController: m_ObjectHideFlags: 0 @@ -278,24 +278,18 @@ AnimatorController: m_Name: Ghost serializedVersion: 5 m_AnimatorParameters: - - m_Name: DirX + - m_Name: Direction m_Type: 1 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} - - m_Name: DirY - m_Type: 1 - m_DefaultFloat: 0 - m_DefaultInt: 0 - m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: GhostType m_Type: 1 m_DefaultFloat: 1 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -317,25 +311,9 @@ BlendTree: m_PrefabAsset: {fileID: 0} m_Name: Pinky m_Childs: - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: c4d80fdae68078f4f999ae9bd0dbad98, type: 2} - m_Threshold: 0 - m_Position: {x: 1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostType - m_Mirror: 0 - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: ba690f8352f83d44db9fe20b91f9bdb8, type: 2} - m_Threshold: 0.33333334 - m_Position: {x: -1, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: GhostType - m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: ab238cd16cad7744fbb93c2da0424514, type: 2} - m_Threshold: 0.6666667 + m_Threshold: 1 m_Position: {x: 0, y: 1} m_TimeScale: 1 m_CycleOffset: 0 @@ -343,19 +321,35 @@ BlendTree: m_Mirror: 0 - serializedVersion: 2 m_Motion: {fileID: 7400000, guid: 0e98f733efc54a14a91d76815115d096, type: 2} - m_Threshold: 1 + m_Threshold: 2 m_Position: {x: 0, y: -1} m_TimeScale: 1 m_CycleOffset: 0 m_DirectBlendParameter: GhostType m_Mirror: 0 - m_BlendParameter: DirX + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: ba690f8352f83d44db9fe20b91f9bdb8, type: 2} + m_Threshold: 4 + m_Position: {x: -1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostType + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: c4d80fdae68078f4f999ae9bd0dbad98, type: 2} + m_Threshold: 8 + m_Position: {x: 1, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: GhostType + m_Mirror: 0 + m_BlendParameter: Direction m_BlendParameterY: DirY - m_MinThreshold: 0 - m_MaxThreshold: 1 - m_UseAutomaticThresholds: 1 + m_MinThreshold: 1 + m_MaxThreshold: 8 + m_UseAutomaticThresholds: 0 m_NormalizedBlendValues: 0 - m_BlendType: 1 + m_BlendType: 0 --- !u!1107 &1877551748267460816 AnimatorStateMachine: serializedVersion: 6 diff --git a/Assets/Animations/PacMan/PacMan.controller b/Assets/Animations/PacMan/PacMan.controller index 1e6f5bd..5bfb94f 100644 --- a/Assets/Animations/PacMan/PacMan.controller +++ b/Assets/Animations/PacMan/PacMan.controller @@ -1,30 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1101 &-9221672682127973356 -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: Reset - m_EventTreshold: 0 - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: 3691335081698814266} - 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!1102 &-6692956035035760530 AnimatorState: serializedVersion: 6 @@ -32,34 +7,7 @@ AnimatorState: m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_Name: Alive - m_Speed: 1 - m_CycleOffset: 0 - m_Transitions: - - {fileID: 6237702739743855209} - m_StateMachineBehaviours: [] - m_Position: {x: 50, y: 50, z: 0} - m_IKOnFeet: 0 - m_WriteDefaultValues: 0 - m_Mirror: 0 - m_SpeedParameterActive: 0 - m_MirrorParameterActive: 0 - m_CycleOffsetParameterActive: 0 - m_TimeParameterActive: 0 - m_Motion: {fileID: -2066582439274221996} - m_Tag: - m_SpeedParameter: - m_MirrorParameter: - m_CycleOffsetParameter: - m_TimeParameter: ---- !u!1102 &-5351155063058543854 -AnimatorState: - serializedVersion: 6 - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: Dead + m_Name: PacMan m_Speed: 1 m_CycleOffset: 0 m_Transitions: [] @@ -72,7 +20,7 @@ AnimatorState: m_MirrorParameterActive: 0 m_CycleOffsetParameterActive: 0 m_TimeParameterActive: 0 - m_Motion: {fileID: 7400000, guid: 60532b76a26184441b2940a09b1bc07e, type: 2} + m_Motion: {fileID: -2066582439274221996} m_Tag: m_SpeedParameter: m_MirrorParameter: @@ -92,52 +40,91 @@ BlendTree: m_Position: {x: 0, y: 0} m_TimeScale: 1 m_CycleOffset: 0 - m_DirectBlendParameter: Direction + m_DirectBlendParameter: State m_Mirror: 0 - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: 946abf85568070046b684c122ab8c4d3, type: 2} - m_Threshold: 0.25 - m_Position: {x: 0, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: Blend - m_Mirror: 0 - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: 73786a7794bff2a4cab6595789479a9a, type: 2} - m_Threshold: 0.5 - m_Position: {x: 0, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: Blend - m_Mirror: 0 - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: 13e7b0ee5b399f6469049de82d79df18, type: 2} - m_Threshold: 0.75 - m_Position: {x: 0, y: 0} - m_TimeScale: 1 - m_CycleOffset: 0 - m_DirectBlendParameter: Blend - m_Mirror: 0 - - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: d21f099d8860b8541960bb36f8ec4eac, type: 2} + m_Motion: {fileID: 6902226148018916867} m_Threshold: 1 m_Position: {x: 0, y: 0} m_TimeScale: 1 m_CycleOffset: 0 - m_DirectBlendParameter: Blend + m_DirectBlendParameter: State m_Mirror: 0 - serializedVersion: 2 - m_Motion: {fileID: 7400000, guid: a28e7bee3098d0a4996a108a60ccf4c0, type: 2} - m_Threshold: 1.25 + m_Motion: {fileID: -363858950277856849} + m_Threshold: 2 m_Position: {x: 0, y: 0} m_TimeScale: 1 m_CycleOffset: 0 - m_DirectBlendParameter: Direction + m_DirectBlendParameter: State + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 60532b76a26184441b2940a09b1bc07e, type: 2} + m_Threshold: 3 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: a28e7bee3098d0a4996a108a60ccf4c0, type: 2} + m_Threshold: 4 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State + m_Mirror: 0 + m_BlendParameter: State + m_BlendParameterY: Blend + m_MinThreshold: 0 + m_MaxThreshold: 4 + m_UseAutomaticThresholds: 0 + m_NormalizedBlendValues: 0 + m_BlendType: 0 +--- !u!206 &-363858950277856849 +BlendTree: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Stopped + m_Childs: + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: c3664638441f28a43ae34a14711f1bb8, type: 2} + m_Threshold: 1 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: bfa17ff437ea1c54cb39e122f0b21896, type: 2} + m_Threshold: 2 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 8f4fe9b8c3a3716418e0d6666757e956, type: 2} + m_Threshold: 4 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 014d5ceffb960844099b49fc63651f78, type: 2} + m_Threshold: 8 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State m_Mirror: 0 m_BlendParameter: Direction m_BlendParameterY: Blend - m_MinThreshold: 0 - m_MaxThreshold: 1.25 + m_MinThreshold: 1 + m_MaxThreshold: 8 m_UseAutomaticThresholds: 0 m_NormalizedBlendValues: 0 m_BlendType: 0 @@ -150,30 +137,18 @@ AnimatorController: m_Name: PacMan serializedVersion: 5 m_AnimatorParameters: - - m_Name: Dead - m_Type: 4 + - m_Name: State + m_Type: 1 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} - - m_Name: Eating - m_Type: 4 - m_DefaultFloat: 0 - m_DefaultInt: 0 - m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} - m_Name: Direction m_Type: 1 m_DefaultFloat: 0 m_DefaultInt: 0 m_DefaultBool: 0 - m_Controller: {fileID: 9100000} - - m_Name: Reset - m_Type: 9 - m_DefaultFloat: 0 - m_DefaultInt: 0 - m_DefaultBool: 0 - m_Controller: {fileID: 9100000} + m_Controller: {fileID: 0} m_AnimatorLayers: - serializedVersion: 5 m_Name: Base Layer @@ -187,80 +162,53 @@ AnimatorController: m_IKPass: 0 m_SyncedLayerAffectsTiming: 0 m_Controller: {fileID: 9100000} ---- !u!1101 &1948315071244049044 -AnimatorStateTransition: +--- !u!206 &6902226148018916867 +BlendTree: 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: -6692956035035760530} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0.25 - m_TransitionOffset: 0 - m_ExitTime: 0.01 - m_HasExitTime: 1 - m_HasFixedDuration: 1 - m_InterruptionSource: 0 - m_OrderedInterruption: 1 - m_CanTransitionToSelf: 1 ---- !u!1102 &3691335081698814266 -AnimatorState: - serializedVersion: 6 - m_ObjectHideFlags: 1 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_Name: PacManInitial - m_Speed: 1 - m_CycleOffset: 0 - m_Transitions: - - {fileID: 1948315071244049044} - m_StateMachineBehaviours: [] - m_Position: {x: 50, y: 50, z: 0} - m_IKOnFeet: 0 - m_WriteDefaultValues: 1 - m_Mirror: 0 - m_SpeedParameterActive: 0 - m_MirrorParameterActive: 0 - m_CycleOffsetParameterActive: 0 - m_TimeParameterActive: 0 - m_Motion: {fileID: 7400000, guid: 66f7552143c8ca6458831daadd2eafc0, type: 2} - m_Tag: - m_SpeedParameter: - m_MirrorParameter: - m_CycleOffsetParameter: - m_TimeParameter: ---- !u!1101 &6237702739743855209 -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: Dead - m_EventTreshold: 0 - m_DstStateMachine: {fileID: 0} - m_DstState: {fileID: -5351155063058543854} - m_Solo: 0 - m_Mute: 0 - m_IsExit: 0 - serializedVersion: 3 - m_TransitionDuration: 0 - m_TransitionOffset: 0 - m_ExitTime: 0.16666669 - m_HasExitTime: 0 - m_HasFixedDuration: 1 - m_InterruptionSource: 0 - m_OrderedInterruption: 1 - m_CanTransitionToSelf: 1 + m_Name: Moving + m_Childs: + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 13e7b0ee5b399f6469049de82d79df18, type: 2} + m_Threshold: 1 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: d21f099d8860b8541960bb36f8ec4eac, type: 2} + m_Threshold: 2 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 73786a7794bff2a4cab6595789479a9a, type: 2} + m_Threshold: 4 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 946abf85568070046b684c122ab8c4d3, type: 2} + m_Threshold: 8 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: State + m_Mirror: 0 + m_BlendParameter: Direction + m_BlendParameterY: State + m_MinThreshold: 1 + m_MaxThreshold: 8 + m_UseAutomaticThresholds: 0 + m_NormalizedBlendValues: 0 + m_BlendType: 0 --- !u!1107 &7006696717309671173 AnimatorStateMachine: serializedVersion: 6 @@ -270,18 +218,11 @@ AnimatorStateMachine: m_PrefabAsset: {fileID: 0} m_Name: Base Layer m_ChildStates: - - serializedVersion: 1 - m_State: {fileID: -5351155063058543854} - m_Position: {x: 380, y: 230, z: 0} - serializedVersion: 1 m_State: {fileID: -6692956035035760530} - m_Position: {x: 470, y: 100, z: 0} - - serializedVersion: 1 - m_State: {fileID: 3691335081698814266} - m_Position: {x: 250, y: -10, z: 0} + m_Position: {x: 420, y: 70, z: 0} m_ChildStateMachines: [] - m_AnyStateTransitions: - - {fileID: -9221672682127973356} + m_AnyStateTransitions: [] m_EntryTransitions: [] m_StateMachineTransitions: {} m_StateMachineBehaviours: [] @@ -289,4 +230,4 @@ AnimatorStateMachine: m_EntryPosition: {x: 70, y: 100, z: 0} m_ExitPosition: {x: 800, y: 120, z: 0} m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} - m_DefaultState: {fileID: 3691335081698814266} + m_DefaultState: {fileID: -6692956035035760530} diff --git a/Assets/Animations/PacMan/PacManStoppedDown.anim b/Assets/Animations/PacMan/PacManStoppedDown.anim new file mode 100644 index 0000000..a9aef5b --- /dev/null +++ b/Assets/Animations/PacMan/PacManStoppedDown.anim @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PacManStoppedDown + serializedVersion: 7 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: + - serializedVersion: 2 + curve: + - time: 0 + value: {fileID: -1291921845, guid: 7c9882097c3869842a9cfc7730a9a2dc, type: 3} + attribute: m_Sprite + path: + classID: 212 + script: {fileID: 0} + flags: 2 + m_SampleRate: 40 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + pptrCurveMapping: + - {fileID: -1291921845, guid: 7c9882097c3869842a9cfc7730a9a2dc, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.025 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: [] + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Animations/PacMan/PacManStoppedDown.anim.meta b/Assets/Animations/PacMan/PacManStoppedDown.anim.meta new file mode 100644 index 0000000..ae3fd8e --- /dev/null +++ b/Assets/Animations/PacMan/PacManStoppedDown.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bfa17ff437ea1c54cb39e122f0b21896 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/PacMan/PacManStoppedLeft.anim b/Assets/Animations/PacMan/PacManStoppedLeft.anim new file mode 100644 index 0000000..1489cf4 --- /dev/null +++ b/Assets/Animations/PacMan/PacManStoppedLeft.anim @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PacManStoppedLeft + serializedVersion: 7 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: + - serializedVersion: 2 + curve: + - time: 0 + value: {fileID: -154195759, guid: 7c9882097c3869842a9cfc7730a9a2dc, type: 3} + attribute: m_Sprite + path: + classID: 212 + script: {fileID: 0} + flags: 2 + m_SampleRate: 40 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + pptrCurveMapping: + - {fileID: -154195759, guid: 7c9882097c3869842a9cfc7730a9a2dc, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.025 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: [] + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Animations/PacMan/PacManStoppedLeft.anim.meta b/Assets/Animations/PacMan/PacManStoppedLeft.anim.meta new file mode 100644 index 0000000..b567962 --- /dev/null +++ b/Assets/Animations/PacMan/PacManStoppedLeft.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f4fe9b8c3a3716418e0d6666757e956 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/PacMan/PacManStoppedRight.anim b/Assets/Animations/PacMan/PacManStoppedRight.anim new file mode 100644 index 0000000..2583edf --- /dev/null +++ b/Assets/Animations/PacMan/PacManStoppedRight.anim @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PacManStoppedRight + serializedVersion: 7 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: + - serializedVersion: 2 + curve: + - time: 0 + value: {fileID: -1273145802, guid: 7c9882097c3869842a9cfc7730a9a2dc, type: 3} + attribute: m_Sprite + path: + classID: 212 + script: {fileID: 0} + flags: 2 + m_SampleRate: 40 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + pptrCurveMapping: + - {fileID: -1273145802, guid: 7c9882097c3869842a9cfc7730a9a2dc, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.025 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: [] + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Animations/PacMan/PacManStoppedRight.anim.meta b/Assets/Animations/PacMan/PacManStoppedRight.anim.meta new file mode 100644 index 0000000..eff0ce4 --- /dev/null +++ b/Assets/Animations/PacMan/PacManStoppedRight.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 014d5ceffb960844099b49fc63651f78 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/PacMan/PacManStoppedUp.anim b/Assets/Animations/PacMan/PacManStoppedUp.anim new file mode 100644 index 0000000..26787b7 --- /dev/null +++ b/Assets/Animations/PacMan/PacManStoppedUp.anim @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: PacManStoppedUp + serializedVersion: 7 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: + - serializedVersion: 2 + curve: + - time: 0 + value: {fileID: -388737089, guid: 7c9882097c3869842a9cfc7730a9a2dc, type: 3} + attribute: m_Sprite + path: + classID: 212 + script: {fileID: 0} + flags: 2 + m_SampleRate: 40 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 0 + script: {fileID: 0} + typeID: 212 + customType: 23 + isPPtrCurve: 1 + isIntCurve: 0 + isSerializeReferenceCurve: 0 + pptrCurveMapping: + - {fileID: -388737089, guid: 7c9882097c3869842a9cfc7730a9a2dc, type: 3} + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 0.025 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: [] + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Animations/PacMan/PacManStoppedUp.anim.meta b/Assets/Animations/PacMan/PacManStoppedUp.anim.meta new file mode 100644 index 0000000..cc31d73 --- /dev/null +++ b/Assets/Animations/PacMan/PacManStoppedUp.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c3664638441f28a43ae34a14711f1bb8 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/PacMan.unity b/Assets/Scenes/PacMan.unity index 7f53619..cb2407c 100644 --- a/Assets/Scenes/PacMan.unity +++ b/Assets/Scenes/PacMan.unity @@ -204,11 +204,11 @@ Transform: m_GameObject: {fileID: 20511503} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 4.266148, y: 14.909718, z: -30.038902} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 806746267} + m_Father: {fileID: 712073434} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &22916692 stripped GameObject: @@ -3591,12 +3591,12 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 675058736} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 4.266148, y: 14.909718, z: -30.038902} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] - m_Father: {fileID: 806746267} + m_Father: {fileID: 712073434} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &675308624 stripped GameObject: @@ -3805,6 +3805,8 @@ Transform: - {fileID: 1672574592} - {fileID: 2005609925} - {fileID: 393606783} + - {fileID: 675058737} + - {fileID: 20511504} m_Father: {fileID: 1886023632} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &712508021 stripped @@ -4183,8 +4185,6 @@ Transform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1131865220} - - {fileID: 675058737} - - {fileID: 20511504} - {fileID: 1266097396} - {fileID: 1501975777} - {fileID: 234876909} @@ -10735,10 +10735,6 @@ MonoBehaviour: ID: 289 SerializedTypeNames: - VRC.Udon.UdonBehaviour - - gameObject: {fileID: 0} - ID: 290 - SerializedTypeNames: - - VRC.Udon.UdonBehaviour - gameObject: {fileID: 1749838339} ID: 292 SerializedTypeNames: @@ -11859,10 +11855,6 @@ MonoBehaviour: ID: 579 SerializedTypeNames: - VRC.Udon.UdonBehaviour - - gameObject: {fileID: 0} - ID: 580 - SerializedTypeNames: - - VRC.Udon.UdonBehaviour - gameObject: {fileID: 993328805} ID: 581 SerializedTypeNames: @@ -14451,6 +14443,10 @@ PrefabInstance: propertyPath: serializationData.Prefab value: objectReference: {fileID: 3166429239840473342, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} + - target: {fileID: 3178542716354759352, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} + propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Arguments.m_StringArgument + value: JumpToTimeSequenceIntermission3 + objectReference: {fileID: 0} - target: {fileID: 3180767675366436896, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} propertyPath: serializationData.Prefab value: @@ -15131,6 +15127,10 @@ PrefabInstance: propertyPath: serializationData.Prefab value: objectReference: {fileID: 7573811225412740220, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} + - target: {fileID: 7577918268698087260, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} + propertyPath: collisionManager + value: + objectReference: {fileID: 1777057130} - target: {fileID: 7577918268698087260, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3} propertyPath: serializationData.Prefab value: diff --git a/Assets/Scripts/Ghost.asset b/Assets/Scripts/Ghost.asset index 03a10cb..2013247 100644 --- a/Assets/Scripts/Ghost.asset +++ b/Assets/Scripts/Ghost.asset @@ -43,7 +43,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 42 + Data: 44 - Name: Entry: 7 Data: @@ -2122,19 +2122,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: cardinalDirections + Data: animatorKeyDirection - Name: $v Entry: 7 Data: 107|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: cardinalDirections + Data: animatorKeyDirection - Name: k__BackingField Entry: 9 - Data: 100 + Data: 8 - Name: k__BackingField Entry: 9 - Data: 101 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -2171,19 +2171,19 @@ MonoBehaviour: Data: - Name: $k Entry: 1 - Data: horizontalDirections + Data: animatorKeyGhostType - Name: $v Entry: 7 Data: 109|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor - Name: k__BackingField Entry: 1 - Data: horizontalDirections + Data: animatorKeyGhostType - Name: k__BackingField Entry: 9 - Data: 100 + Data: 8 - Name: k__BackingField Entry: 9 - Data: 101 + Data: 8 - Name: k__BackingField Entry: 7 Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib @@ -2215,6 +2215,104 @@ MonoBehaviour: - Name: Entry: 8 Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: cardinalDirections + - Name: $v + Entry: 7 + Data: 111|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: cardinalDirections + - Name: k__BackingField + Entry: 9 + Data: 100 + - Name: k__BackingField + Entry: 9 + Data: 101 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 112|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], + mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: horizontalDirections + - Name: $v + Entry: 7 + Data: 113|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: horizontalDirections + - Name: k__BackingField + Entry: 9 + Data: 100 + - Name: k__BackingField + Entry: 9 + Data: 101 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 114|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], + mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: - Name: Entry: 13 Data: diff --git a/Assets/Scripts/Ghost.cs b/Assets/Scripts/Ghost.cs index 8adeafc..31c3501 100644 --- a/Assets/Scripts/Ghost.cs +++ b/Assets/Scripts/Ghost.cs @@ -89,6 +89,9 @@ namespace Marro.PacManUdon public bool IsScared => isScared; public int Index { get; private set; } + private readonly int animatorKeyDirection = Animator.StringToHash("Direction"); + private readonly int animatorKeyGhostType = Animator.StringToHash("GhostType"); + public void Initialize(CollisionManager collisionManager, PacMan pacMan, Ghost blinky, Transform startTransform, Vector2 homePosition, Vector2 idlePosition1, Vector2 idlePosition2, Vector2 cornerPosition, int index) { ghostManager = transform.parent.GetComponent(); @@ -341,20 +344,9 @@ namespace Marro.PacManUdon // } if (isScared) { - switch (PseudoRNG() % 4) - { - default: - return gridPosition; - case 0: - return gridPosition + Vector2.up; - case 1: - return gridPosition + Vector2.left; - case 2: - return gridPosition + Vector2.down; - case 3: - return gridPosition + Vector2.right; - } + return gridPosition + directionVectors[(int)cardinalDirections[PseudoRNG() % 4]]; } + switch (ghostState) { default: @@ -456,7 +448,7 @@ namespace Marro.PacManUdon rngState ^= rngState << 13; rngState ^= rngState >> 17; rngState ^= rngState << 5; - return rngState; + return Math.Abs(rngState); } private readonly Direction[] cardinalDirections = new Direction[] { Direction.Up, Direction.Left, Direction.Down, Direction.Right }; @@ -507,16 +499,12 @@ namespace Marro.PacManUdon // Debug.Log($"{gameObject} UpdateAnimator with state: {ghostState}, isScared: {isScared}, direction: {direction}"); if (specialLook) { - animator.SetFloat("GhostType", GhostTypeToAnimationValue(PacManGhostType.Special)); + SetAnimatorGhostType((int)PacManGhostType.Special); } else if (isScared) { - float currentGhostType = animator.GetFloat("GhostType"); - if (currentGhostType > 0.5f && currentGhostType < 2.5f) - { - return; - } - animator.SetFloat("GhostType", GhostTypeToAnimationValue(PacManGhostType.Scared)); + + SetAnimatorGhostType((int)PacManGhostType.Scared); } else { @@ -527,58 +515,35 @@ namespace Marro.PacManUdon case PacManGhostState.Home: case PacManGhostState.Exiting: // Debug.Log($"{gameObject} Set GhostType in animator to: {GhostTypeToAnimationValue(ghostType)}"); - animator.SetFloat("GhostType", GhostTypeToAnimationValue(ghostType)); + SetAnimatorGhostType((int)ghostType); break; case PacManGhostState.Returning: case PacManGhostState.Entering: - animator.SetFloat("GhostType", GhostTypeToAnimationValue(PacManGhostType.Caught)); + SetAnimatorGhostType((int)PacManGhostType.Caught); break; } } if (faceInStartingDirectionUntilUnfrozen && startState == PacManGhostStartState.TargetingIdlePosition1) { - animator.SetFloat("DirX", 0); - animator.SetFloat("DirY", 1); + SetAnimatorDirection((int)Direction.Up); } else if (faceInStartingDirectionUntilUnfrozen && startState == PacManGhostStartState.TargetingIdlePosition2) { - animator.SetFloat("DirX", 0); - animator.SetFloat("DirY", -1); + SetAnimatorDirection((int)Direction.Down); } else if (specialLook || targetDirection != Direction.Zero) { - var vector = GetVector(targetDirection); - animator.SetFloat("DirX", vector.x); - animator.SetFloat("DirY", vector.y); + SetAnimatorDirection((int)targetDirection); } } - private float GhostTypeToAnimationValue(PacManGhostType ghostType) - { - switch (ghostType) - { - default: - Debug.LogError("Invalid ghost animation value!"); - return 0; - case PacManGhostType.Caught: - return 0; - case PacManGhostType.Scared: - return 1; - case PacManGhostType.ScaredWhite: - return 2; - case PacManGhostType.Blinky: - return 3; - case PacManGhostType.Pinky: - return 4; - case PacManGhostType.Inky: - return 5; - case PacManGhostType.Clyde: - return 6; - case PacManGhostType.Special: - return 7; - } - } + // A Udon bug means converting an enum to a float causes an exception unless the conversion from int to float is in a separate method + private void SetAnimatorDirection(int value) => + animator.SetFloat(animatorKeyDirection, value); + + private void SetAnimatorGhostType(int value) => + animator.SetFloat(animatorKeyGhostType, value); public void UpdateSpeed() { @@ -743,14 +708,7 @@ namespace Marro.PacManUdon if (!isScared || !gameObject.activeInHierarchy) return; - if (white) - { - animator.SetFloat("GhostType", 2); - } - else - { - animator.SetFloat("GhostType", 1); - } + SetAnimatorGhostType(white ? (int)PacManGhostType.ScaredWhite : (int)PacManGhostType.Scared); } public void SetElroy(int elroyLevel) diff --git a/Assets/Scripts/PacMan.asset b/Assets/Scripts/PacMan.asset index 1215261..6d81818 100644 --- a/Assets/Scripts/PacMan.asset +++ b/Assets/Scripts/PacMan.asset @@ -43,7 +43,7 @@ MonoBehaviour: Data: - Name: Entry: 12 - Data: 22 + Data: 24 - Name: Entry: 7 Data: @@ -1196,6 +1196,102 @@ MonoBehaviour: - Name: Entry: 8 Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: animatorKeyState + - Name: $v + Entry: 7 + Data: 62|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: animatorKeyState + - Name: k__BackingField + Entry: 9 + Data: 8 + - Name: k__BackingField + Entry: 9 + Data: 8 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 63|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 7 + Data: + - Name: $k + Entry: 1 + Data: animatorKeyDirection + - Name: $v + Entry: 7 + Data: 64|UdonSharp.Compiler.FieldDefinition, UdonSharp.Editor + - Name: k__BackingField + Entry: 1 + Data: animatorKeyDirection + - Name: k__BackingField + Entry: 9 + Data: 8 + - Name: k__BackingField + Entry: 9 + Data: 8 + - Name: k__BackingField + Entry: 7 + Data: System.Nullable`1[[UdonSharp.UdonSyncMode, UdonSharp.Runtime]], mscorlib + - Name: + Entry: 6 + Data: + - Name: + Entry: 8 + Data: + - Name: k__BackingField + Entry: 5 + Data: false + - Name: _fieldAttributes + Entry: 7 + Data: 65|System.Collections.Generic.List`1[[System.Attribute, mscorlib]], mscorlib + - Name: + Entry: 12 + Data: 0 + - Name: + Entry: 13 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: + - Name: + Entry: 8 + Data: - Name: Entry: 13 Data: diff --git a/Assets/Scripts/PacMan.cs b/Assets/Scripts/PacMan.cs index b27910a..c6b32a1 100644 --- a/Assets/Scripts/PacMan.cs +++ b/Assets/Scripts/PacMan.cs @@ -3,6 +3,15 @@ using UnityEngine; namespace Marro.PacManUdon { + enum PacManAnimatorState + { + Idle, + Moving, + Stopped, + Dead, + Big + } + [RequireComponent(typeof(Animator))] [RequireComponent(typeof(Renderer))] public class PacMan : GridMover @@ -29,14 +38,8 @@ namespace Marro.PacManUdon private bool frozen; #region Animator constants - private const string AnimatorKeyDead = "Dead"; - private const string AnimatorKeyDirection = "Direction"; - private const float AnimatorDirectionNone = 0f; - private const float AnimatorDirectionRight = 0.25f; - private const float AnimatorDirectionLeft = 0.50f; - private const float AnimatorDirectionDown = 0.75f; - private const float AnimatorDirectionUp = 1f; - private const float AnimatorDirectionRightBig = 1.25f; + private readonly int animatorKeyState = Animator.StringToHash("State"); + private readonly int animatorKeyDirection = Animator.StringToHash("Direction"); #endregion @@ -65,9 +68,8 @@ namespace Marro.PacManUdon followingPredefinedPath = false; SetDead(false); - animator.SetTrigger("Reset"); - //Debug.Log($"{gameObject} Reset! Position is now {GetPosition()}."); + SetAnimatorState((int)PacManAnimatorState.Idle); } public override void SyncedUpdate() @@ -225,44 +227,41 @@ namespace Marro.PacManUdon protected override void UpdateAnimator() { - // Debug.Log($"{gameObject} UpdateAnimator with direction {direction}, dead {dead}, frozen {frozen}"); + Debug.Log($"{gameObject} UpdateAnimator with direction {direction}, dead {dead}, frozen {frozen}"); if (!gameObject.activeInHierarchy) return; - animator.SetBool(AnimatorKeyDead, dead); if (dead) { + SetAnimatorState((int)PacManAnimatorState.Dead); animator.speed = 1; return; } - if (frozen || direction.Equals(Direction.Zero)) + animator.speed = frozen ? 0 : 1; + + if (frozen) { - animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionNone); - animator.speed = 0; + return; + } + + if (direction.Equals(Direction.Zero)) + { + SetAnimatorState((int)PacManAnimatorState.Stopped); } else { - animator.speed = 1; - if (targetDirection.Equals(Direction.Right)) - { - animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionRight); - } - else if (targetDirection.Equals(Direction.Left)) - { - animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionLeft); - } - else if (targetDirection.Equals(Direction.Down)) - { - animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionDown); - } - else if (targetDirection.Equals(Direction.Up)) - { - animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionUp); - } + SetAnimatorState((int)PacManAnimatorState.Moving); + SetAnimatorDirection((int)targetDirection); } } + private void SetAnimatorDirection(int value) => + animator.SetFloat(animatorKeyDirection, value); + + private void SetAnimatorState(int value) => + animator.SetFloat(animatorKeyState, value); + public void SetDead(bool dead) { this.dead = dead; @@ -324,7 +323,7 @@ namespace Marro.PacManUdon public void BecomeBig() { - animator.SetFloat(AnimatorKeyDirection, AnimatorDirectionRightBig); + SetAnimatorState((int)PacManAnimatorState.Big); } void SetVisibility(bool visible)