From 885657b91044dd8bbe408231fcc53b7d846ae9a3 Mon Sep 17 00:00:00 2001 From: Ali Sharoz <187120652+alisharoz666@users.noreply.github.com> Date: Tue, 9 Sep 2025 16:46:17 +0500 Subject: [PATCH] Crate Escape Completed --- .../Misc/Emojis/Part 1/em_clenchteeth2.mat | 18 +- .../Zibu_Animator_SingleLayer.controller | 29 + Assets/Scenes/CrateEscape.unity | 737 +++++++++++++++++- .../CrateEscapePlayerControllerJoystick.cs | 260 ++++-- Assets/Scripts/CrateEscape/LaserBeam.cs | 66 +- .../CrateEscape/LaserBeamController.cs | 167 ++-- .../CrateEscape/LevelCompleteDoorTrigger.cs | 7 +- Assets/Scripts/Shared/SmoothChildRotation.cs | 140 +++- Assets/Scripts/Shared/ZibuAnimDriver.cs | 5 + ProjectSettings/EditorBuildSettings.asset | 4 +- ProjectSettings/ProjectSettings.asset | 10 +- 11 files changed, 1223 insertions(+), 220 deletions(-) diff --git a/Assets/3rd/Epic Toon FX/Materials/Misc/Emojis/Part 1/em_clenchteeth2.mat b/Assets/3rd/Epic Toon FX/Materials/Misc/Emojis/Part 1/em_clenchteeth2.mat index 652a818..0f1d338 100644 --- a/Assets/3rd/Epic Toon FX/Materials/Misc/Emojis/Part 1/em_clenchteeth2.mat +++ b/Assets/3rd/Epic Toon FX/Materials/Misc/Emojis/Part 1/em_clenchteeth2.mat @@ -2,13 +2,18 @@ %TAG !u! tag:unity3d.com,2011: --- !u!21 &2100000 Material: - serializedVersion: 6 + serializedVersion: 8 m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} m_Name: em_clenchteeth2 m_Shader: {fileID: 211, guid: 0000000000000000f000000000000000, type: 0} - m_ShaderKeywords: _ALPHABLEND_ON + m_Parent: {fileID: 0} + m_ModifiedSerializedProperties: 0 + m_ValidKeywords: + - _ALPHABLEND_ON + m_InvalidKeywords: [] m_LightmapFlags: 0 m_EnableInstancingVariants: 0 m_DoubleSidedGI: 0 @@ -16,7 +21,8 @@ Material: stringTagMap: RenderType: Transparent disabledShaderPasses: - - ALWAYS + - GRABPASS + m_LockedProperties: m_SavedProperties: serializedVersion: 3 m_TexEnvs: @@ -32,6 +38,7 @@ Material: m_Texture: {fileID: 2800000, guid: deb28cb372e1ee54fad618f6df43247f, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} + m_Ints: [] m_Floats: - _BlendOp: 0 - _BumpScale: 1 @@ -63,3 +70,4 @@ Material: - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0} - _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5} + m_BuildTextureStacks: [] diff --git a/Assets/Animators/Zibu_Animator_SingleLayer.controller b/Assets/Animators/Zibu_Animator_SingleLayer.controller index 7e74577..3dbca34 100644 --- a/Assets/Animators/Zibu_Animator_SingleLayer.controller +++ b/Assets/Animators/Zibu_Animator_SingleLayer.controller @@ -580,6 +580,32 @@ AnimatorStateTransition: m_InterruptionSource: 0 m_OrderedInterruption: 1 m_CanTransitionToSelf: 1 +--- !u!1102 &-3331804382887163694 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Celebration + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + 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: 3060610079319413300, guid: f4cc7d9b87c59db4b83522e99e842364, type: 3} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: --- !u!1101 &-2923408276037091438 AnimatorStateTransition: m_ObjectHideFlags: 1 @@ -956,6 +982,9 @@ AnimatorStateMachine: - serializedVersion: 1 m_State: {fileID: 7977088065826294681} m_Position: {x: 1635, y: 2665, z: 0} + - serializedVersion: 1 + m_State: {fileID: -3331804382887163694} + m_Position: {x: 420, y: 400, z: 0} m_ChildStateMachines: - serializedVersion: 1 m_StateMachine: {fileID: 7036095546467220257} diff --git a/Assets/Scenes/CrateEscape.unity b/Assets/Scenes/CrateEscape.unity index 197c0cb..980786a 100644 --- a/Assets/Scenes/CrateEscape.unity +++ b/Assets/Scenes/CrateEscape.unity @@ -504,7 +504,7 @@ Transform: m_GameObject: {fileID: 12973084} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.91, y: -0.01, z: -2.14} + m_LocalPosition: {x: 0.07, y: -0.01, z: -2.14} m_LocalScale: {x: 70, y: 70, z: 70} m_ConstrainProportionsScale: 0 m_Children: [] @@ -1024,7 +1024,7 @@ Transform: m_GameObject: {fileID: 49986390} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.912, y: -0.01, z: -0.839} + m_LocalPosition: {x: 0.84, y: -0.01, z: -1.1} m_LocalScale: {x: 100, y: 100, z: 100} m_ConstrainProportionsScale: 0 m_Children: [] @@ -2772,7 +2772,7 @@ Transform: m_GameObject: {fileID: 153719132} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.91, y: -0.01, z: -2.14} + m_LocalPosition: {x: 6, y: -0.01, z: -2.21} m_LocalScale: {x: 70, y: 70, z: 70} m_ConstrainProportionsScale: 0 m_Children: [] @@ -2926,6 +2926,113 @@ Transform: - {fileID: 1655399795} m_Father: {fileID: 1820171607} m_LocalEulerAnglesHint: {x: 4.956153e-15, y: 8.2657737e-17, z: 1.7794487} +--- !u!1 &159551600 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 159551601} + - component: {fileID: 159551604} + - component: {fileID: 159551603} + - component: {fileID: 159551602} + m_Layer: 0 + m_Name: SM_Cone_B (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &159551601 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 159551600} + serializedVersion: 2 + m_LocalRotation: {x: -0.61813235, y: -0.34338397, z: -0.34338412, w: 0.618132} + m_LocalPosition: {x: -1.7, y: -0, z: -1.74} + m_LocalScale: {x: 60.000004, y: 60.000004, z: 60.000004} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 414159266235080744} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &159551602 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 159551600} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 5 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: -6885938102116908473, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} +--- !u!23 &159551603 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 159551600} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 9003353085549565770, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} + - {fileID: 115445013013025135, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &159551604 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 159551600} + m_Mesh: {fileID: -6885938102116908473, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} --- !u!1 &161977769 GameObject: m_ObjectHideFlags: 0 @@ -3021,6 +3128,139 @@ Transform: - {fileID: 2012919120} m_Father: {fileID: 793746112} m_LocalEulerAnglesHint: {x: 0.012706863, y: 179.99994, z: 2.35607} +--- !u!1 &169818117 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 169818118} + - component: {fileID: 169818121} + - component: {fileID: 169818120} + - component: {fileID: 169818119} + m_Layer: 5 + m_Name: JumpButton + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &169818118 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 169818117} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 620234703} + m_Father: {fileID: 1692212856} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 32} + m_SizeDelta: {x: 395.9401, y: 74.2388} + m_Pivot: {x: 0.5, y: 0} +--- !u!114 &169818119 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 169818117} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 169818120} + m_OnClick: + m_PersistentCalls: + m_Calls: + - m_Target: {fileID: 0} + m_TargetAssemblyTypeName: + m_MethodName: + m_Mode: 1 + m_Arguments: + m_ObjectArgument: {fileID: 0} + m_ObjectArgumentAssemblyTypeName: + m_IntArgument: 0 + m_FloatArgument: 0 + m_StringArgument: + m_BoolArgument: 0 + m_CallState: 2 +--- !u!114 &169818120 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 169818117} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &169818121 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 169818117} + m_CullTransparentMesh: 1 --- !u!1001 &170801089 PrefabInstance: m_ObjectHideFlags: 0 @@ -4216,6 +4456,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fb66dc0e33e58d7439c1db6e435dcc9e, type: 3} m_Name: m_EditorClassIdentifier: + externalControl: 1 maxDistance: 6.2 collisionMask: serializedVersion: 2 @@ -7565,6 +7806,113 @@ Transform: m_Children: [] m_Father: {fileID: 2001361206} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &448567980 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 448567981} + - component: {fileID: 448567984} + - component: {fileID: 448567983} + - component: {fileID: 448567982} + m_Layer: 0 + m_Name: SM_Cone_A (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &448567981 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 448567980} + serializedVersion: 2 + m_LocalRotation: {x: 0.19540694, y: 0.6795705, z: 0.6795706, w: -0.19540687} + m_LocalPosition: {x: 8.83, y: 0, z: -2.41} + m_LocalScale: {x: 60.000004, y: 60.000004, z: 60.000004} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 414159266235080744} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &448567982 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 448567980} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 5 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: -2458358804769231553, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} +--- !u!23 &448567983 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 448567980} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 9003353085549565770, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} + - {fileID: 115445013013025135, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &448567984 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 448567980} + m_Mesh: {fileID: -2458358804769231553, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} --- !u!1001 &448919822 PrefabInstance: m_ObjectHideFlags: 0 @@ -8417,7 +8765,7 @@ Transform: m_GameObject: {fileID: 515354678} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 3.0304422, y: -0.008347869, z: -4.237848} + m_LocalPosition: {x: -0.39, y: -0.01, z: -4.35} m_LocalScale: {x: 100, y: 100, z: 100} m_ConstrainProportionsScale: 0 m_Children: [] @@ -9535,7 +9883,7 @@ Transform: m_GameObject: {fileID: 574382112} serializedVersion: 2 m_LocalRotation: {x: -0.00000015695825, y: 0, z: -0, w: 1} - m_LocalPosition: {x: 2.997, y: 0.53, z: -4.91} + m_LocalPosition: {x: 5.32, y: 0.53, z: -6.17} m_LocalScale: {x: 81.764275, y: 81.764275, z: 81.764275} m_ConstrainProportionsScale: 0 m_Children: [] @@ -10476,6 +10824,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fb66dc0e33e58d7439c1db6e435dcc9e, type: 3} m_Name: m_EditorClassIdentifier: + externalControl: 1 maxDistance: 6.2 collisionMask: serializedVersion: 2 @@ -10722,6 +11071,140 @@ Transform: m_Children: [] m_Father: {fileID: 260718851} m_LocalEulerAnglesHint: {x: 36.642, y: -143.732, z: 0} +--- !u!1 &620234702 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 620234703} + - component: {fileID: 620234705} + - component: {fileID: 620234704} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &620234703 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 620234702} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 169818118} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &620234704 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 620234702} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: JUMP + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 9f7cb4b53799717478f208258f1af701, type: 2} + m_sharedMaterial: {fileID: -7900421164380424285, guid: 9f7cb4b53799717478f208258f1af701, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 63.35 + m_fontSizeBase: 24 + m_fontWeight: 400 + m_enableAutoSizing: 1 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &620234705 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 620234702} + m_CullTransparentMesh: 1 --- !u!1001 &622447770 PrefabInstance: m_ObjectHideFlags: 0 @@ -10978,7 +11461,7 @@ Transform: m_GameObject: {fileID: 648341497} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.015, y: -0.082, z: 0} + m_LocalPosition: {x: -0.934, y: -0.082, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: @@ -12105,6 +12588,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fb66dc0e33e58d7439c1db6e435dcc9e, type: 3} m_Name: m_EditorClassIdentifier: + externalControl: 1 maxDistance: 6.2 collisionMask: serializedVersion: 2 @@ -12346,7 +12830,7 @@ Transform: m_GameObject: {fileID: 769463177} serializedVersion: 2 m_LocalRotation: {x: -0.00000015695825, y: 0, z: -0, w: 1} - m_LocalPosition: {x: 2.997, y: 0.53, z: -2.72} + m_LocalPosition: {x: 5.84, y: 0.53, z: -1.96} m_LocalScale: {x: 81.764275, y: 81.764275, z: 81.764275} m_ConstrainProportionsScale: 0 m_Children: [] @@ -13950,7 +14434,7 @@ Transform: m_GameObject: {fileID: 844890850} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.908, y: -0.01, z: -0.09} + m_LocalPosition: {x: 1, y: -0.01, z: -0.57} m_LocalScale: {x: 100, y: 100, z: 100} m_ConstrainProportionsScale: 0 m_Children: [] @@ -14877,7 +15361,7 @@ Transform: m_GameObject: {fileID: 889923819} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.866, y: -0.008347869, z: -4.237848} + m_LocalPosition: {x: 4.78, y: -0.01, z: -5.57} m_LocalScale: {x: 100, y: 100, z: 100} m_ConstrainProportionsScale: 0 m_Children: [] @@ -15159,7 +15643,7 @@ Transform: m_GameObject: {fileID: 897256666} serializedVersion: 2 m_LocalRotation: {x: -0.00000015695825, y: 0, z: -0, w: 1} - m_LocalPosition: {x: 2.997, y: 0.53, z: -7.18} + m_LocalPosition: {x: 6.6, y: 0.53, z: -6.94} m_LocalScale: {x: 81.764275, y: 81.764275, z: 81.764275} m_ConstrainProportionsScale: 0 m_Children: [] @@ -15740,7 +16224,7 @@ Transform: m_GameObject: {fileID: 918938912} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.91, y: -0.01, z: -2.14} + m_LocalPosition: {x: 2.24, y: -0.01, z: -2.03} m_LocalScale: {x: 70, y: 70, z: 70} m_ConstrainProportionsScale: 0 m_Children: [] @@ -17231,7 +17715,7 @@ Transform: m_GameObject: {fileID: 1030970977} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.91, y: -0.01, z: -0.09} + m_LocalPosition: {x: -0.97, y: -0.01, z: 1.87} m_LocalScale: {x: 100, y: 100, z: 100} m_ConstrainProportionsScale: 0 m_Children: [] @@ -18340,8 +18824,14 @@ MonoBehaviour: moveDamp: 12 maxSpeedMultiplier: 3 inputDeadZone: 0.1 - cameraRelative: 0 + cameraRelative: 1 cameraTransform: {fileID: 0} + useDynamicGroundNormal: 0 + staticUp: {x: 0, y: 1, z: 0} + groundForNormalMask: + serializedVersion: 2 + m_Bits: 4294967295 + groundNormalRayLength: 3 faceMoveDirection: 1 turnSpeed: 540 groundMask: @@ -18349,10 +18839,17 @@ MonoBehaviour: m_Bits: 4294967295 groundCheckRadius: 0.2 groundCheck: {fileID: 1078607385} + jumpForce: 7 + allowAirJump: 0 + jumpButton: {fileID: 169818119} anim: {fileID: 0} initialLockSeconds: 4 useUnscaledForInitialLock: 0 autoLockOnGameOver: 1 + debugLogs: 1 + drawMoveRay: 1 + keyboardFallbackInEditor: 1 + ignoreGameOverLock: 0 --- !u!1 &1079485366 GameObject: m_ObjectHideFlags: 0 @@ -21813,7 +22310,7 @@ Transform: m_GameObject: {fileID: 1259538718} serializedVersion: 2 m_LocalRotation: {x: -0.00000015695825, y: 0, z: -0, w: 1} - m_LocalPosition: {x: 2.997, y: 0.53, z: -2.72} + m_LocalPosition: {x: 2.2, y: 0.53, z: -4.06} m_LocalScale: {x: 81.764275, y: 81.764275, z: 81.764275} m_ConstrainProportionsScale: 0 m_Children: [] @@ -22154,7 +22651,7 @@ Transform: m_GameObject: {fileID: 1285724024} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.91, y: -0.01, z: 0.94} + m_LocalPosition: {x: 2.87, y: -0.01, z: 1.62} m_LocalScale: {x: 100, y: 100, z: 100} m_ConstrainProportionsScale: 0 m_Children: [] @@ -23464,8 +23961,14 @@ MonoBehaviour: moveDamp: 12 maxSpeedMultiplier: 3 inputDeadZone: 0.1 - cameraRelative: 0 + cameraRelative: 1 cameraTransform: {fileID: 0} + useDynamicGroundNormal: 0 + staticUp: {x: 0, y: 1, z: 0} + groundForNormalMask: + serializedVersion: 2 + m_Bits: 4294967295 + groundNormalRayLength: 3 faceMoveDirection: 1 turnSpeed: 540 groundMask: @@ -23473,10 +23976,17 @@ MonoBehaviour: m_Bits: 4294967295 groundCheckRadius: 0.2 groundCheck: {fileID: 1329894559} + jumpForce: 7 + allowAirJump: 0 + jumpButton: {fileID: 169818119} anim: {fileID: 0} initialLockSeconds: 4 useUnscaledForInitialLock: 0 autoLockOnGameOver: 1 + debugLogs: 1 + drawMoveRay: 1 + keyboardFallbackInEditor: 1 + ignoreGameOverLock: 0 --- !u!1 &1330849551 GameObject: m_ObjectHideFlags: 0 @@ -23938,7 +24448,7 @@ Transform: m_GameObject: {fileID: 1367607038} serializedVersion: 2 m_LocalRotation: {x: -0.00000015695825, y: 0, z: -0, w: 1} - m_LocalPosition: {x: 2.997, y: 0.53, z: -6.04} + m_LocalPosition: {x: 0.92, y: 0.53, z: -5.24} m_LocalScale: {x: 81.764275, y: 81.764275, z: 81.764275} m_ConstrainProportionsScale: 0 m_Children: [] @@ -24218,6 +24728,113 @@ Transform: m_CorrespondingSourceObject: {fileID: 810243670578391327, guid: c49d51dc6e703e14098f304b68ff1e43, type: 3} m_PrefabInstance: {fileID: 1379398093} m_PrefabAsset: {fileID: 0} +--- !u!1 &1393154373 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1393154374} + - component: {fileID: 1393154377} + - component: {fileID: 1393154376} + - component: {fileID: 1393154375} + m_Layer: 0 + m_Name: SM_Cone_A (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1393154374 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1393154373} + serializedVersion: 2 + m_LocalRotation: {x: 0.19540694, y: 0.6795705, z: 0.6795706, w: -0.19540687} + m_LocalPosition: {x: 4.35, y: -0, z: 5.24} + m_LocalScale: {x: 60.000004, y: 60.000004, z: 60.000004} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 414159266235080744} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!64 &1393154375 +MeshCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1393154373} + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_IsTrigger: 0 + m_ProvidesContacts: 0 + m_Enabled: 1 + serializedVersion: 5 + m_Convex: 0 + m_CookingOptions: 30 + m_Mesh: {fileID: -2458358804769231553, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} +--- !u!23 &1393154376 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1393154373} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 9003353085549565770, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} + - {fileID: 115445013013025135, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!33 &1393154377 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1393154373} + m_Mesh: {fileID: -2458358804769231553, guid: 966cfe98504e69c4f93880b9de3b84c3, type: 3} --- !u!1001 &1404367912 PrefabInstance: m_ObjectHideFlags: 0 @@ -25538,7 +26155,7 @@ Transform: m_GameObject: {fileID: 1476704811} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 1.648, y: -0.01, z: -1.25} + m_LocalPosition: {x: 0.25, y: -0.01, z: 0.11} m_LocalScale: {x: 100, y: 100, z: 100} m_ConstrainProportionsScale: 0 m_Children: [] @@ -27150,9 +27767,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9511137add479ac46a49f0f07d801aea, type: 3} m_Name: m_EditorClassIdentifier: - interval: 9 - chargeDuration: 3 + interval: 10 + idleBeforeCharge: 3 + chargingWindup: 1 fireDuration: 1 + allLasers: [] --- !u!4 &1588204517 Transform: m_ObjectHideFlags: 0 @@ -28992,9 +29611,10 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 1460610360} - {fileID: 385283700} - {fileID: 1686300321} - - {fileID: 1460610360} + - {fileID: 169818118} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -29032,7 +29652,7 @@ Transform: m_GameObject: {fileID: 1699517209} serializedVersion: 2 m_LocalRotation: {x: -0.00000015695825, y: 0, z: -0, w: 1} - m_LocalPosition: {x: 2.997, y: 0.53, z: -2.72} + m_LocalPosition: {x: 3.98, y: 0.53, z: -2.07} m_LocalScale: {x: 81.764275, y: 81.764275, z: 81.764275} m_ConstrainProportionsScale: 0 m_Children: [] @@ -29493,6 +30113,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fb66dc0e33e58d7439c1db6e435dcc9e, type: 3} m_Name: m_EditorClassIdentifier: + externalControl: 1 maxDistance: 6.2 collisionMask: serializedVersion: 2 @@ -31247,8 +31868,8 @@ BoxCollider: m_ProvidesContacts: 0 m_Enabled: 1 serializedVersion: 3 - m_Size: {x: 1, y: 1, z: 1} - m_Center: {x: -0.47, y: -0.35, z: -0.35} + m_Size: {x: 1, y: 1.8795884, z: 1} + m_Center: {x: -0.47000003, y: -0.78979427, z: -0.34999996} --- !u!114 &1786728441 MonoBehaviour: m_ObjectHideFlags: 0 @@ -31267,6 +31888,15 @@ MonoBehaviour: rotationEase: 6 targetRotationOnEnter: {x: 0, y: 0, z: -90} targetRotationOnExit: {x: 0, y: 0, z: 0} + exitPoint: {fileID: 1927331188} + exitForwardDistance: 3 + faceDuration: 0.2 + celebrationStateName: Celebration + walkStateName: Run + celebrationDuration: 1.2 + walkMoveDuration: 1.5 + walkMoveEase: 1 + disableTriggerAfterUse: 1 --- !u!1 &1798127834 GameObject: m_ObjectHideFlags: 0 @@ -31518,7 +32148,7 @@ Transform: m_GameObject: {fileID: 1808690591} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.91, y: -0.01, z: -1.12} + m_LocalPosition: {x: 3.91, y: -0.01, z: -1.12} m_LocalScale: {x: 70, y: 70, z: 70} m_ConstrainProportionsScale: 0 m_Children: [] @@ -32003,8 +32633,14 @@ MonoBehaviour: moveDamp: 12 maxSpeedMultiplier: 3 inputDeadZone: 0.1 - cameraRelative: 0 + cameraRelative: 1 cameraTransform: {fileID: 0} + useDynamicGroundNormal: 0 + staticUp: {x: 0, y: 1, z: 0} + groundForNormalMask: + serializedVersion: 2 + m_Bits: 4294967295 + groundNormalRayLength: 3 faceMoveDirection: 1 turnSpeed: 540 groundMask: @@ -32012,10 +32648,17 @@ MonoBehaviour: m_Bits: 4294967295 groundCheckRadius: 0.2 groundCheck: {fileID: 1816328266} + jumpForce: 7 + allowAirJump: 0 + jumpButton: {fileID: 169818119} anim: {fileID: 0} initialLockSeconds: 4 useUnscaledForInitialLock: 0 autoLockOnGameOver: 1 + debugLogs: 1 + drawMoveRay: 1 + keyboardFallbackInEditor: 1 + ignoreGameOverLock: 0 --- !u!1 &1820171606 GameObject: m_ObjectHideFlags: 0 @@ -33132,7 +33775,7 @@ Transform: m_GameObject: {fileID: 1922771307} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.918, y: -0.01, z: 0.94} + m_LocalPosition: {x: 4.64, y: -0.01, z: 1.6} m_LocalScale: {x: 100, y: 100, z: 100} m_ConstrainProportionsScale: 0 m_Children: [] @@ -33376,8 +34019,8 @@ Transform: m_GameObject: {fileID: 1927331187} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} - m_LocalPosition: {x: -0.4664, y: 0.158, z: 0} - m_LocalScale: {x: 0.35970727, y: 0.83797306, z: 1.5858829} + m_LocalPosition: {x: -0.47, y: 1.29, z: 0} + m_LocalScale: {x: 1.0305613, y: 2.4007928, z: 4.5435543} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1786728439} @@ -33622,7 +34265,7 @@ Transform: m_GameObject: {fileID: 1937888781} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 2.91, y: -0.01, z: -1.12} + m_LocalPosition: {x: 5.9, y: -0.01, z: -1.21} m_LocalScale: {x: 70, y: 70, z: 70} m_ConstrainProportionsScale: 0 m_Children: [] @@ -35534,7 +36177,7 @@ Transform: m_GameObject: {fileID: 2093987299} serializedVersion: 2 m_LocalRotation: {x: -0.00000015695825, y: 0, z: -0, w: 1} - m_LocalPosition: {x: 2.997, y: 0.53, z: -4.91} + m_LocalPosition: {x: 4.64, y: 0.53, z: -5.63} m_LocalScale: {x: 81.764275, y: 81.764275, z: 81.764275} m_ConstrainProportionsScale: 0 m_Children: [] @@ -36204,7 +36847,7 @@ Transform: m_GameObject: {fileID: 2133030684} serializedVersion: 2 m_LocalRotation: {x: -0.7071068, y: 0, z: -0, w: 0.7071067} - m_LocalPosition: {x: 1.648, y: -0.01, z: -4.27} + m_LocalPosition: {x: -0.27, y: -0.01, z: -8.71} m_LocalScale: {x: 100, y: 100, z: 100} m_ConstrainProportionsScale: 0 m_Children: [] @@ -36951,7 +37594,10 @@ Transform: - {fileID: 4042657798250749998} - {fileID: 5343468960385212202} - {fileID: 8764602699115127370} + - {fileID: 448567981} + - {fileID: 1393154374} - {fileID: 7402324720996412932} + - {fileID: 159551601} - {fileID: 5357786166604310237} - {fileID: 1827221995141390180} - {fileID: 6529274538521272810} @@ -37438,8 +38084,8 @@ Transform: m_GameObject: {fileID: 8764099260871452027} serializedVersion: 2 m_LocalRotation: {x: 0.7071069, y: -0.00000001545431, z: 0.000000015454306, w: 0.70710677} - m_LocalPosition: {x: -0.4574666, y: -0.050120294, z: 0.19419003} - m_LocalScale: {x: 835.0777, y: 835.0782, z: 835.0782} + m_LocalPosition: {x: 0.46153355, y: -0.05012007, z: 0.19419003} + m_LocalScale: {x: 835.0778, y: 835.0783, z: 835.0784} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 648341498} @@ -41597,7 +42243,7 @@ Transform: m_GameObject: {fileID: 4971902394948504409} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.475, y: 0, z: 0} + m_LocalPosition: {x: 0.44400024, y: 0, z: 0} m_LocalScale: {x: 271.3123, y: 271.31226, z: 271.31226} m_ConstrainProportionsScale: 0 m_Children: [] @@ -42131,19 +42777,32 @@ MonoBehaviour: moveDamp: 12 maxSpeedMultiplier: 3 inputDeadZone: 0.1 - cameraRelative: 0 + cameraRelative: 1 cameraTransform: {fileID: 0} + useDynamicGroundNormal: 0 + staticUp: {x: 0, y: 1, z: 0} + groundForNormalMask: + serializedVersion: 2 + m_Bits: 4294967295 + groundNormalRayLength: 3 faceMoveDirection: 1 turnSpeed: 540 groundMask: serializedVersion: 2 m_Bits: 4294967295 groundCheckRadius: 0.2 - groundCheck: {fileID: 0} + groundCheck: {fileID: 5402742484430148059} + jumpForce: 7 + allowAirJump: 0 + jumpButton: {fileID: 0} anim: {fileID: 0} initialLockSeconds: 4 useUnscaledForInitialLock: 0 autoLockOnGameOver: 1 + debugLogs: 1 + drawMoveRay: 1 + keyboardFallbackInEditor: 1 + ignoreGameOverLock: 0 --- !u!23 &7399880856154375157 MeshRenderer: m_ObjectHideFlags: 0 @@ -42195,7 +42854,7 @@ Transform: m_GameObject: {fileID: 1254911690890077024} serializedVersion: 2 m_LocalRotation: {x: -0.61813235, y: -0.34338397, z: -0.34338412, w: 0.618132} - m_LocalPosition: {x: 0.6011245, y: 0, z: 3.0131884} + m_LocalPosition: {x: -2.03, y: 0, z: 3.65} m_LocalScale: {x: 60.000004, y: 60.000004, z: 60.000004} m_ConstrainProportionsScale: 0 m_Children: [] @@ -43423,7 +44082,7 @@ Transform: m_GameObject: {fileID: 1957592180749302299} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.45, y: 0, z: 0} + m_LocalPosition: {x: 0.46899986, y: 0, z: 0} m_LocalScale: {x: 271.3123, y: 271.31226, z: 271.31226} m_ConstrainProportionsScale: 0 m_Children: [] diff --git a/Assets/Scripts/CrateEscape/CrateEscapePlayerControllerJoystick.cs b/Assets/Scripts/CrateEscape/CrateEscapePlayerControllerJoystick.cs index 0fbc473..15f53d8 100644 --- a/Assets/Scripts/CrateEscape/CrateEscapePlayerControllerJoystick.cs +++ b/Assets/Scripts/CrateEscape/CrateEscapePlayerControllerJoystick.cs @@ -1,64 +1,106 @@ -using UnityEngine; +using UnityEngine; +using UnityEngine.UI; -// Joystick Pack (Asset Store) -// Drag any Joystick (Fixed/Floating/Dynamic/Variable) into moveJoystick [RequireComponent(typeof(Rigidbody))] public class CrateEscapePlayerControllerJoystick : MonoBehaviour { [Header("Joystick")] - public Joystick moveJoystick; // assign from Joystick Pack + public Joystick moveJoystick; [Header("Movement")] - public float moveSpeed = 4f; // base speed - public float moveDamp = 12f; // velocity smoothing - public float maxSpeedMultiplier = 3f; // full-stick multiplier + public float moveSpeed = 4f; + public float moveDamp = 12f; // smoothing for XZ + public float maxSpeedMultiplier = 3f; // full-stick multiplier [Range(0f, 0.5f)] public float inputDeadZone = 0.1f; [Tooltip("If true, stick is interpreted relative to the camera view.")] public bool cameraRelative = true; - public Transform cameraTransform; // auto-fills with Camera.main if null + public Transform cameraTransform; + + [Header("Movement Plane")] + [Tooltip("If OFF, uses Static Up as the movement plane normal. If ON, raycasts to read ground normal under the character.")] + public bool useDynamicGroundNormal = false; + [Tooltip("Used when useDynamicGroundNormal = false. Set this to your level's 'up' direction (the plane normal).")] + public Vector3 staticUp = Vector3.up; + [Tooltip("Layer mask for reading ground normal when dynamic is ON.")] + public LayerMask groundForNormalMask = ~0; + [Tooltip("Ray length for sampling ground normal beneath groundCheck.")] + public float groundNormalRayLength = 3f; [Header("Facing")] - public bool faceMoveDirection = true; // rotate toward move direction - public float turnSpeed = 540f; // deg/sec rotation speed + public bool faceMoveDirection = true; + public float turnSpeed = 540f; // deg/sec [Header("Grounding")] public LayerMask groundMask = ~0; public float groundCheckRadius = 0.2f; public Transform groundCheck; + [Header("Jump")] + public float jumpForce = 7f; // upward impulse + public bool allowAirJump = false; + public Button jumpButton; + [Header("Optional Animator Driver")] public ZibuAnimDriver anim; [Header("Input Locks")] - public float initialLockSeconds = 4f; // joystick disabled for first N seconds - public bool useUnscaledForInitialLock = false; // set true if you pause time at start - public bool autoLockOnGameOver = true; // auto-freeze if GameManager reports isGameOver + public float initialLockSeconds = 0f; // keep 0 while testing + public bool useUnscaledForInitialLock = false; + public bool autoLockOnGameOver = true; + + [Header("Debug / Safety")] + public bool debugLogs = true; // show values in console + public bool drawMoveRay = true; // shows a cyan ray for move direction + public bool keyboardFallbackInEditor = true; // WASD/Arrow fallback when joystick is null or zero + public bool ignoreGameOverLock = false; // bypass GameManager lock (testing) // --- runtime --- Rigidbody _rb; - Vector3 _vel; // smoothed velocity - Vector3 _moveDirWorld; // desired movement direction in world space - float _stickMag; // 0..1 - bool _inputEnabled = false; // starts locked; enabled after initialLockSeconds + Vector3 _velXZ; // horizontal velocity (XZ only) + Vector3 _moveDirWorld; // desired move dir on movement plane + float _stickMag; // 0..1 + bool _inputEnabled = false; // true when controls active + bool _jumpQueued; + bool _usedAirJump; void Awake() { _rb = GetComponent(); - // keep physics stable + _rb.useGravity = true; + _rb.isKinematic = false; + + // Lock only tilt, never lock Position X/Y/Z here _rb.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationZ; + // Good physics defaults + if (_rb.mass <= 0f) _rb.mass = 1f; + _rb.drag = 0f; // don’t damp velocity away + _rb.angularDrag = 0.05f; + _rb.collisionDetectionMode = CollisionDetectionMode.Continuous; + if (!groundCheck) groundCheck = transform; if (!anim) anim = GetComponent(); if (!cameraTransform && Camera.main) cameraTransform = Camera.main.transform; } + void OnValidate() + { + if (!cameraTransform && Camera.main) cameraTransform = Camera.main.transform; + if (!groundCheck) groundCheck = transform; + } + void OnEnable() { - // start locked, then enable after delay _inputEnabled = false; StopAllCoroutines(); StartCoroutine(EnableAfterDelay(initialLockSeconds, useUnscaledForInitialLock)); + if (jumpButton) jumpButton.onClick.AddListener(OnJumpUIButton); + } + + void OnDisable() + { + if (jumpButton) jumpButton.onClick.RemoveListener(OnJumpUIButton); } System.Collections.IEnumerator EnableAfterDelay(float seconds, bool unscaled) @@ -69,6 +111,7 @@ public class CrateEscapePlayerControllerJoystick : MonoBehaviour else yield return new WaitForSeconds(seconds); } _inputEnabled = true; + if (debugLogs) Debug.Log($"[CrateEscape] Controls ENABLED (delay={seconds}) on {name}"); } void Update() @@ -76,35 +119,52 @@ public class CrateEscapePlayerControllerJoystick : MonoBehaviour bool blocked = IsBlocked(); if (!blocked) - ReadJoystick(); + { + ReadMoveInput(); + } else { - // when blocked, zero input so the player stops + anim goes idle _stickMag = 0f; _moveDirWorld = Vector3.zero; } + // animator hooks if (anim) { float speedUnits = Mathf.Lerp(0f, maxSpeedMultiplier, _stickMag); anim.SetGrounded(IsGrounded()); anim.SetSpeed(speedUnits); } + + // Reset air-jump on ground contact + if (IsGrounded()) _usedAirJump = false; + + // Debug ray + if (drawMoveRay && _moveDirWorld.sqrMagnitude > 0.0001f) + Debug.DrawRay(transform.position + Vector3.up * 0.1f, _moveDirWorld.normalized, Color.cyan, 0f, false); + + if (debugLogs) + { + if (Time.frameCount % 30 == 0) + { + Debug.Log($"[CrateEscape] {name} inputEnabled={_inputEnabled} blocked={blocked} stickMag={_stickMag:F2} dir={_moveDirWorld}"); + } + } } void FixedUpdate() { bool blocked = IsBlocked(); - Vector3 targetVel = Vector3.zero; + Vector3 targetVelXZ = Vector3.zero; if (!blocked && _stickMag > inputDeadZone) { Vector3 dir = _moveDirWorld.normalized; float targetSpeed = moveSpeed * Mathf.Lerp(0f, maxSpeedMultiplier, _stickMag); - targetVel = dir * targetSpeed; + targetVelXZ = dir * targetSpeed; - if (faceMoveDirection) + if (faceMoveDirection && dir.sqrMagnitude > 0.0001f) { Quaternion targetRot = Quaternion.LookRotation(dir, Vector3.up); _rb.MoveRotation(Quaternion.RotateTowards(_rb.rotation, targetRot, turnSpeed * Time.fixedDeltaTime)); @@ -113,47 +173,131 @@ public class CrateEscapePlayerControllerJoystick : MonoBehaviour if (blocked) { - // hard-stop while locked - _vel = Vector3.zero; - _rb.velocity = Vector3.zero; - return; // don't MovePosition this frame + // Stop horizontal movement but preserve Y (gravity / jump settle) + _velXZ = Vector3.zero; + _rb.velocity = new Vector3(0f, _rb.velocity.y, 0f); + _jumpQueued = false; + return; } - // Smooth velocity and move - _vel = Vector3.Lerp(_vel, targetVel, 1f - Mathf.Exp(-moveDamp * Time.fixedDeltaTime)); - _rb.MovePosition(_rb.position + _vel * Time.fixedDeltaTime); + // Smooth horizontal velocity (keep physics-driven Y) + _velXZ = Vector3.Lerp(_velXZ, targetVelXZ, 1f - Mathf.Exp(-moveDamp * Time.fixedDeltaTime)); + + // Apply horizontal velocity while preserving current Y + _rb.velocity = new Vector3(_velXZ.x, _rb.velocity.y, _velXZ.z); + + // Handle jump in physics step + if (_jumpQueued) + { + _jumpQueued = false; + DoJump(); + } } - void ReadJoystick() + // ---------- Input ---------- + + void ReadMoveInput() { - if (!moveJoystick) { _stickMag = 0f; _moveDirWorld = Vector3.zero; return; } + Vector2 stick = Vector2.zero; - float h = moveJoystick.Horizontal; // -1..1 - float v = moveJoystick.Vertical; // -1..1 + // Prefer joystick if present and non-zero + if (moveJoystick) + { + stick = new Vector2(moveJoystick.Horizontal, moveJoystick.Vertical); + } + +#if UNITY_EDITOR + // Optional keyboard fallback (Editor/testing) + if (keyboardFallbackInEditor) + { + if (stick.sqrMagnitude <= 0.0001f) + { + float h = Input.GetAxisRaw("Horizontal"); // A/D or Left/Right + float v = Input.GetAxisRaw("Vertical"); // W/S or Up/Down + if (Mathf.Abs(h) > 0.01f || Mathf.Abs(v) > 0.01f) + stick = new Vector2(h, v); + } + } +#endif - Vector2 stick = new Vector2(h, v); _stickMag = Mathf.Clamp01(stick.magnitude); - if (_stickMag <= inputDeadZone) { _moveDirWorld = Vector3.zero; return; } + if (_stickMag <= inputDeadZone) + { + _moveDirWorld = Vector3.zero; + return; + } Vector2 n = stick.normalized; if (cameraRelative && cameraTransform) { - // Project camera forward to XZ and build a right vector - Vector3 camF = cameraTransform.forward; camF.y = 0f; - camF = camF.sqrMagnitude > 0.0001f ? camF.normalized : Vector3.forward; - Vector3 camR = new Vector3(camF.z, 0f, -camF.x); + // Plane-aware camera relative vectors + Vector3 planeUp = GetMovementUp(); + + // Project camera forward onto the plane + Vector3 camF = Vector3.ProjectOnPlane(cameraTransform.forward, planeUp); + if (camF.sqrMagnitude < 0.0001f) + camF = Vector3.ProjectOnPlane(cameraTransform.up, planeUp); + camF.Normalize(); + + // Right is perpendicular on the plane + Vector3 camR = Vector3.Cross(planeUp, camF).normalized; + + // Re-orthonormalize camF to be safe + camF = Vector3.Cross(camR, planeUp).normalized; _moveDirWorld = camR * n.x + camF * n.y; } else { - // World-relative (X/Z) - _moveDirWorld = new Vector3(n.x, 0f, n.y); + // World-relative, but still constrained to the plane + Vector3 planeUp = GetMovementUp(); + Vector3 worldX = Vector3.ProjectOnPlane(Vector3.right, planeUp).normalized; + Vector3 worldZ = Vector3.ProjectOnPlane(Vector3.forward, planeUp).normalized; + _moveDirWorld = (worldX * n.x + worldZ * n.y); } } + Vector3 GetMovementUp() + { + if (useDynamicGroundNormal && groundCheck) + { + // Cast along character's local down to find the surface normal + Ray ray = new Ray(groundCheck.position + Vector3.up * 0.05f, -transform.up); + if (Physics.Raycast(ray, out var hit, groundNormalRayLength, groundForNormalMask, QueryTriggerInteraction.Ignore)) + { + return hit.normal.normalized; + } + } + // Fallback to static up + return staticUp.sqrMagnitude > 0.0001f ? staticUp.normalized : Vector3.up; + } + + void DoJump() + { + bool grounded = IsGrounded(); + + if (!grounded) + { + if (!(allowAirJump && !_usedAirJump)) return; + _usedAirJump = true; + } + + // Reset vertical velocity then apply impulse for consistent jumps + Vector3 v = _rb.velocity; + v.y = 0f; + _rb.velocity = v; + + _rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse); + + if (anim) anim.PlayAnimation(AnimationState.JumpStart); + + if (debugLogs) Debug.Log($"[CrateEscape] {name} JUMP (grounded={grounded}, airUsed={_usedAirJump})"); + } + + // ---------- Ground / Gizmos ---------- + bool IsGrounded() { return Physics.CheckSphere(groundCheck.position, groundCheckRadius, groundMask, QueryTriggerInteraction.Ignore); @@ -168,7 +312,6 @@ public class CrateEscapePlayerControllerJoystick : MonoBehaviour // ---------- Public API ---------- - /// Enable/disable all player input & movement immediately. public void LockControls(bool locked) { _inputEnabled = !locked; @@ -176,25 +319,26 @@ public class CrateEscapePlayerControllerJoystick : MonoBehaviour { _stickMag = 0f; _moveDirWorld = Vector3.zero; - _vel = Vector3.zero; - if (_rb) _rb.velocity = Vector3.zero; + _velXZ = Vector3.zero; + if (_rb) _rb.velocity = new Vector3(0f, _rb.velocity.y, 0f); if (anim) { anim.SetSpeed(0f); } } } - /// Enable controls now (e.g., if you want to skip the initial delay). public void EnableControlsNow() { StopAllCoroutines(); _inputEnabled = true; + if (debugLogs) Debug.Log($"[CrateEscape] Controls ENABLED by call on {name}"); } // ---------- Helpers ---------- + bool IsBlocked() { if (!_inputEnabled) return true; - if (autoLockOnGameOver) + if (!ignoreGameOverLock && autoLockOnGameOver) { var gm = CrateEscapeGameManager.Instance; if (gm != null && gm.isGameOver) return true; // freeze after game over @@ -203,6 +347,24 @@ public class CrateEscapePlayerControllerJoystick : MonoBehaviour return false; } - // For runtime hookup if you spawn the joystick UI public void SetJoystick(Joystick j) => moveJoystick = j; + + // ---------- UI Button Hook ---------- + /// Call this from a UI Button OnClick() to make the player jump. + public void OnJumpUIButton() + { + if (IsBlocked()) return; + + if (IsGrounded() || (allowAirJump && !_usedAirJump)) + _jumpQueued = true; + } + + // ---------- Inspector Utilities ---------- + [ContextMenu("Test/Nudge Forward")] + void NudgeForward() + { + // Small forward push to verify movement pipeline + _rb.velocity = new Vector3(2f, _rb.velocity.y, 0f); + if (debugLogs) Debug.Log($"[CrateEscape] {name} NudgeForward called."); + } } diff --git a/Assets/Scripts/CrateEscape/LaserBeam.cs b/Assets/Scripts/CrateEscape/LaserBeam.cs index 8e3d33c..ddb75ba 100644 --- a/Assets/Scripts/CrateEscape/LaserBeam.cs +++ b/Assets/Scripts/CrateEscape/LaserBeam.cs @@ -4,11 +4,15 @@ using System.Collections; [RequireComponent(typeof(LineRenderer))] public class LaserBeam : MonoBehaviour { + [Header("Control")] + [Tooltip("If true, this beam will NOT run its own timers or intro; it only responds to the controller.")] + public bool externalControl = true; + [Header("Laser Settings")] public float maxDistance = 20f; public LayerMask collisionMask = ~0; - public float chargeDuration = 3f; - public float fireDuration = 1f; + public float chargeDuration = 3f; // used only if externalControl == false + public float fireDuration = 1f; // used only if externalControl == false [Header("Laser Appearance")] public Color laserColor = Color.red; @@ -22,7 +26,7 @@ public class LaserBeam : MonoBehaviour public float hitRadius = 0.1f; public QueryTriggerInteraction queryTriggerMode = QueryTriggerInteraction.Collide; - [Header("Intro Show")] + [Header("Intro Show (ignored if externalControl)")] public bool showIntro = true; public float initialShowDuration = 3f; public bool introIsDeadly = true; @@ -59,16 +63,30 @@ public class LaserBeam : MonoBehaviour void Awake() { SetupLaserRenderer(); + // Always start safe + currentPhase = LaserPhase.Idle; + hasTriggeredDeathThisBurst = false; + DisableLaser(); + StopAllCoroutines(); } void Start() { - if (showIntro) + // Only self-run if not externally controlled + if (!externalControl && showIntro) StartCoroutine(IntroShow()); } void Update() { + if (externalControl) + { + // Passive: only draw debug line if visible + if (debugDraw) Debug.DrawLine(laserStart, laserEnd, Color.cyan); + return; + } + + // Legacy self-FSM (optional use) if (introRunning) return; timer += Time.deltaTime; @@ -113,8 +131,19 @@ public class LaserBeam : MonoBehaviour Debug.DrawLine(laserStart, laserEnd, Color.cyan); } + // LaserBeam.cs — replace SetLaserPhase with this version public void SetLaserPhase(LaserPhase phase) { + // If we’re externally controlled, cancel any internal coroutines immediately + if (externalControl) + { + StopAllCoroutines(); + introRunning = false; + } + + if (!line) SetupLaserRenderer(); // make sure 'line' exists even if GO was inactive + + if (phase != currentPhase) hasTriggeredDeathThisBurst = false; currentPhase = phase; switch (phase) @@ -131,6 +160,7 @@ public class LaserBeam : MonoBehaviour case LaserPhase.Firing: UpdateLaserPath(); + line.enabled = true; SetLineColor(laserColor); hasTriggeredDeathThisBurst = false; CheckHit(); @@ -140,20 +170,16 @@ public class LaserBeam : MonoBehaviour public void TickLaserDuringFiring() { - if (currentPhase == LaserPhase.Firing) - { - UpdateLaserPath(); - CheckHit(); - } + if (currentPhase != LaserPhase.Firing) return; + UpdateLaserPath(); + CheckHit(); } public void TickLaserDuringCharging() { - if (currentPhase == LaserPhase.Charging) - { - BlinkWarning(); - UpdateLaserPath(); - } + if (currentPhase != LaserPhase.Charging) return; + BlinkWarning(); + UpdateLaserPath(); } IEnumerator IntroShow() @@ -183,6 +209,9 @@ public class LaserBeam : MonoBehaviour void DisableLaser() { line.enabled = false; + // Also clear endpoint for safety/debug + laserStart = transform.position; + laserEnd = laserStart; } void BlinkWarning() @@ -194,6 +223,13 @@ public class LaserBeam : MonoBehaviour void CheckHit() { + // HARD GATES: never kill unless we’re allowed to + if (!isActiveAndEnabled) return; + if (!gameObject.activeInHierarchy) return; + + bool lethalNow = (currentPhase == LaserPhase.Firing) || (introRunning && introIsDeadly); + if (!lethalNow) return; + if (hasTriggeredDeathThisBurst) return; bool CheckSegment(Vector3 a, Vector3 b) @@ -224,7 +260,7 @@ public class LaserBeam : MonoBehaviour return true; } - if (bestCol.CompareTag(boxTag)) + if (bestCol && bestCol.CompareTag(boxTag)) { var boxHealth = bestCol.GetComponent(); if (boxHealth != null) diff --git a/Assets/Scripts/CrateEscape/LaserBeamController.cs b/Assets/Scripts/CrateEscape/LaserBeamController.cs index bdd68c9..0fac468 100644 --- a/Assets/Scripts/CrateEscape/LaserBeamController.cs +++ b/Assets/Scripts/CrateEscape/LaserBeamController.cs @@ -5,112 +5,133 @@ using static LaserBeam; public class LaserBeamController : MonoBehaviour { - public float interval = 20f; - public float chargeDuration = 3f; - public float fireDuration = 1f; + [Header("Cycle Durations")] + public float interval = 20f; // how long each batch runs before switching + public float idleBeforeCharge = 3f; // Idle time before Charging + public float chargingWindup = 1f; // Charging duration (blink) + public float fireDuration = 1f; // Firing duration (lethal) - private List allLasers = new List(); - private List> batches = new List>(); - private List activeLasers = new List(); + [Header("Beams (auto-populated)")] + public List allLasers = new List(); - private float timer = 0f; - private LaserPhase currentPhase = LaserPhase.Idle; + private readonly List> batches = new(); + private readonly List activeLasers = new(); void Start() { + // Use active-only; if you need inactive too, use FindObjectsOfType(true) allLasers.AddRange(FindObjectsOfType()); + foreach (var lb in allLasers) + { + if (!lb) continue; + lb.externalControl = true; // controller owns timing + lb.ResetCycle(); // Idle + line off + lb.enabled = false; // completely inert until selected + } + // Shuffle for (int i = 0; i < allLasers.Count; i++) { - var temp = allLasers[i]; - int rand = Random.Range(i, allLasers.Count); - allLasers[i] = allLasers[rand]; - allLasers[rand] = temp; + int r = Random.Range(i, allLasers.Count); + (allLasers[i], allLasers[r]) = (allLasers[r], allLasers[i]); } // Split into 3 batches - int batchSize = Mathf.CeilToInt(allLasers.Count / 3f); + int batchSize = Mathf.CeilToInt(Mathf.Max(1, allLasers.Count) / 3f); for (int i = 0; i < allLasers.Count; i += batchSize) - { batches.Add(allLasers.GetRange(i, Mathf.Min(batchSize, allLasers.Count - i))); - } - foreach (var lb in allLasers) - lb.enabled = false; - - StartCoroutine(ActivateBatches()); + StartCoroutine(RunBatches()); } - IEnumerator ActivateBatches() + IEnumerator RunBatches() { - for (int i = 0; i < batches.Count; i++) + for (int bi = 0; bi < batches.Count; bi++) { - activeLasers.AddRange(batches[i]); + // Disable everything first + foreach (var lb in allLasers) + if (lb) { lb.enabled = false; lb.ResetCycle(); } - foreach (var laser in activeLasers) - laser.enabled = true; + // Activate this batch + activeLasers.Clear(); + activeLasers.AddRange(batches[bi]); + foreach (var l in activeLasers) + { + if (!l) continue; + l.enabled = true; + l.ResetCycle(); + l.SetLaserPhase(LaserPhase.Idle); + } - ResetAllLasers(); + float batchEnd = Time.time + interval; - yield return new WaitForSeconds(interval); + // Loop phases for the duration of this batch + while (Time.time < batchEnd) + { + // Compute runway required to complete a Charge->Fire sequence + float runway = Mathf.Max(0f, chargingWindup) + Mathf.Max(0f, fireDuration); + float timeLeft = batchEnd - Time.time; + + // If not enough time to do Charging+Firing, just stay Idle until the batch ends. + if (timeLeft < runway) + { + yield return PhaseBlock(LaserPhase.Idle, timeLeft, batchEnd); + break; + } + + // IDLE + float idleTime = Mathf.Max(0f, idleBeforeCharge); + // If idleTime itself would consume too much and leave < runway, trim idle to fit + if (idleTime > 0f && idleTime > timeLeft - runway) + idleTime = Mathf.Max(0f, timeLeft - runway); + + if (idleTime > 0f) + { + yield return PhaseBlock(LaserPhase.Idle, idleTime, batchEnd); + if (Time.time >= batchEnd) break; + } + + // CHARGING (blink) + if (chargingWindup > 0f) + { + yield return PhaseBlock(LaserPhase.Charging, chargingWindup, batchEnd); + // we guaranteed runway, so we should still have time left for Firing + } + + // FIRING (lethal) + if (fireDuration > 0f) + { + yield return PhaseBlock(LaserPhase.Firing, fireDuration, batchEnd); + } + } } } - void Update() + // Set phase for all active lasers and tick per-frame for 'duration' (clamped by batch end) + IEnumerator PhaseBlock(LaserPhase phase, float duration, float batchHardEnd) { - if (activeLasers.Count == 0) return; + SetPhaseForAll(phase); - timer += Time.deltaTime; - - switch (currentPhase) + float end = Mathf.Min(Time.time + duration, batchHardEnd); + while (Time.time < end) { - case LaserPhase.Idle: - if (timer >= chargeDuration) - { - timer = 0f; - currentPhase = LaserPhase.Charging; - foreach (var laser in activeLasers) - laser.SetLaserPhase(LaserPhase.Charging); - } - break; + if (phase == LaserPhase.Charging) + { + foreach (var l in activeLasers) if (l && l.isActiveAndEnabled) l.TickLaserDuringCharging(); + } + else if (phase == LaserPhase.Firing) + { + foreach (var l in activeLasers) if (l && l.isActiveAndEnabled) l.TickLaserDuringFiring(); + } - case LaserPhase.Charging: - foreach (var laser in activeLasers) - laser.TickLaserDuringCharging(); - - if (timer >= 1f) - { - timer = 0f; - currentPhase = LaserPhase.Firing; - foreach (var laser in activeLasers) - laser.SetLaserPhase(LaserPhase.Firing); - } - break; - - case LaserPhase.Firing: - foreach (var laser in activeLasers) - laser.TickLaserDuringFiring(); - - if (timer >= fireDuration) - { - timer = 0f; - currentPhase = LaserPhase.Idle; - foreach (var laser in activeLasers) - laser.SetLaserPhase(LaserPhase.Idle); - } - break; + yield return null; } } - void ResetAllLasers() + void SetPhaseForAll(LaserPhase p) { - timer = 0f; - currentPhase = LaserPhase.Idle; - - foreach (var laser in activeLasers) - { - laser.SetLaserPhase(LaserPhase.Idle); - } + foreach (var l in activeLasers) + if (l && l.isActiveAndEnabled) l.SetLaserPhase(p); } } diff --git a/Assets/Scripts/CrateEscape/LevelCompleteDoorTrigger.cs b/Assets/Scripts/CrateEscape/LevelCompleteDoorTrigger.cs index 5b8bfcf..96cc881 100644 --- a/Assets/Scripts/CrateEscape/LevelCompleteDoorTrigger.cs +++ b/Assets/Scripts/CrateEscape/LevelCompleteDoorTrigger.cs @@ -4,7 +4,10 @@ using UnityEngine; public class LevelCompleteDoorTrigger : MonoBehaviour { public string playerTag = "Player"; - + private void Start() + { + + } void Reset() { // Make sure the collider is a trigger @@ -16,7 +19,7 @@ public class LevelCompleteDoorTrigger : MonoBehaviour { if (other.CompareTag(playerTag)) { - CrateEscapeGameManager.Instance?.OnLevelCompleteTriggered(); + //CrateEscapeGameManager.Instance?.OnLevelCompleteTriggered(); } } } diff --git a/Assets/Scripts/Shared/SmoothChildRotation.cs b/Assets/Scripts/Shared/SmoothChildRotation.cs index b8e1d87..3bfc55d 100644 --- a/Assets/Scripts/Shared/SmoothChildRotation.cs +++ b/Assets/Scripts/Shared/SmoothChildRotation.cs @@ -1,54 +1,134 @@ using UnityEngine; using DG.Tweening; +[RequireComponent(typeof(Collider))] public class SmoothChildRotation : MonoBehaviour { - [Header("References")] - public Transform targetChild; // Child object to rotate - public string playerTag = "Player"; // Tag for player detection + [Header("Door Parts")] + public Transform targetChild; // door mesh child to rotate + public string playerTag = "Player"; - [Header("Rotation Settings")] - public float rotationDuration = 0.5f; // Time in seconds for rotation - public Ease rotationEase = Ease.OutQuad; // Easing type + [Header("Door Rotation")] + public float rotationDuration = 0.5f; + public Ease rotationEase = Ease.OutQuad; public Vector3 targetRotationOnEnter = new Vector3(0, 0, -90); public Vector3 targetRotationOnExit = new Vector3(0, 0, 0); - private Tween currentTween; + [Header("Cutscene: Exit Path")] + [Tooltip("If not set, we use (this.transform.position + this.transform.forward * exitForwardDistance).")] + public Transform exitPoint; + public float exitForwardDistance = 3f; // used when exitPoint is null + public float faceDuration = 0.2f; // how quickly the player faces exit - private void Start() + [Header("Cutscene: Anim States")] + public string celebrationStateName = "Celebration"; + public string walkStateName = "Run"; // or your locomotion state/BT name + + [Header("Cutscene: Timing")] + public float celebrationDuration = 1.2f; // seconds to hold Celebration + public float walkMoveDuration = 1.5f; // seconds to walk to exit + public Ease walkMoveEase = Ease.Linear; + + [Header("Behavior")] + public bool disableTriggerAfterUse = true; // prevents re-entrant triggers + + private Tween _doorTween; + private bool _cutsceneRunning; + + void Reset() { - if (targetChild == null) + var col = GetComponent(); + if (col) col.isTrigger = true; + } + + void Start() + { + if (!targetChild) { - Debug.LogError("Target child is not assigned!"); + Debug.LogError("[SmoothChildRotation] Target child not assigned!", this); enabled = false; - return; } } - private void OnTriggerEnter(Collider other) + void OnTriggerEnter(Collider other) { - if (other.CompareTag(playerTag)) + if (_cutsceneRunning) return; + if (!other.CompareTag(playerTag)) return; + + // Open the door + RotateTo(targetRotationOnEnter); + + // Start the cutscene + StartCoroutine(RunDoorCutscene(other)); + } + + void OnTriggerExit(Collider other) + { + if (!other.CompareTag(playerTag)) return; + if (_cutsceneRunning) return; // don’t close while cutscene is ongoing + RotateTo(targetRotationOnExit); + } + + void RotateTo(Vector3 targetRot) + { + _doorTween?.Kill(); + _doorTween = targetChild + .DOLocalRotate(targetRot, rotationDuration) + .SetEase(rotationEase); + } + + System.Collections.IEnumerator RunDoorCutscene(Collider hit) + { + _cutsceneRunning = true; + if (disableTriggerAfterUse) { var c = GetComponent(); if (c) c.enabled = false; } + + // Find player components + Transform root = hit.attachedRigidbody ? hit.attachedRigidbody.transform : hit.transform.root; + var controller = root.GetComponentInChildren(); + var anim = root.GetComponentInChildren(); + var rb = root.GetComponentInChildren(); + + // 1) Freeze player control & velocity + if (controller) controller.LockControls(true); + if (rb) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; } + + // 2) Work out exit position / facing + Vector3 dst = exitPoint ? exitPoint.position : (transform.position + transform.forward * exitForwardDistance); + if (rb) dst.y = rb.position.y; else dst.y = root.position.y; + + Vector3 faceDir = dst - root.position; faceDir.y = 0f; + if (faceDir.sqrMagnitude > 0.0001f) { - RotateTo(targetRotationOnEnter); + Quaternion look = Quaternion.LookRotation(faceDir.normalized, Vector3.up); + // quick face toward the door exit + root.DORotateQuaternion(look, faceDuration).SetEase(Ease.OutQuad); } - } - private void OnTriggerExit(Collider other) - { - if (other.CompareTag(playerTag)) - { - RotateTo(targetRotationOnExit); - } - } + // 3) Celebration anim + if (anim && !string.IsNullOrEmpty(celebrationStateName)) + anim.PlayState(celebrationStateName, 0.1f); - private void RotateTo(Vector3 targetRot) - { - // Kill any existing tween to avoid stacking - currentTween?.Kill(); + yield return new WaitForSeconds(celebrationDuration); - currentTween = targetChild.DOLocalRotate( - targetRot, - rotationDuration - ).SetEase(rotationEase); + // 4) Walk/Run anim + if (anim && !string.IsNullOrEmpty(walkStateName)) + anim.PlayState(walkStateName, 0.1f); + + // 5) Move player outside the door + Tween moveT; + if (rb != null) + moveT = rb.DOMove(dst, walkMoveDuration).SetEase(walkMoveEase).SetUpdate(UpdateType.Fixed); + else + moveT = root.DOMove(dst, walkMoveDuration).SetEase(walkMoveEase); + + yield return moveT.WaitForCompletion(); + + // 6) Level complete signal + CrateEscapeGameManager.Instance?.OnLevelCompleteTriggered(); + + // (Optional) keep controls locked while level completes. Remove next line if you want to give control back: + // if (controller) controller.LockControls(false); + + _cutsceneRunning = false; } } diff --git a/Assets/Scripts/Shared/ZibuAnimDriver.cs b/Assets/Scripts/Shared/ZibuAnimDriver.cs index 8864531..889046d 100644 --- a/Assets/Scripts/Shared/ZibuAnimDriver.cs +++ b/Assets/Scripts/Shared/ZibuAnimDriver.cs @@ -41,6 +41,11 @@ public class ZibuAnimDriver : MonoBehaviour default: CrossFadeSafe(state.ToString(), xfade); break; } } + public void PlayState(string stateName, float xfade = 0.1f) + { + if (string.IsNullOrEmpty(stateName)) return; + CrossFadeSafe(stateName, xfade); + } void CrossFadeSafe(string stateName, float transition) { diff --git a/ProjectSettings/EditorBuildSettings.asset b/ProjectSettings/EditorBuildSettings.asset index 1875168..5d86303 100644 --- a/ProjectSettings/EditorBuildSettings.asset +++ b/ProjectSettings/EditorBuildSettings.asset @@ -35,7 +35,7 @@ EditorBuildSettings: - enabled: 0 path: Assets/Scenes/ChaseRun.unity guid: be6c423b3d68dcb48bc49a7d2ed4957d - - enabled: 0 + - enabled: 1 path: Assets/Scenes/CrateEscape.unity guid: af5c5d2a2d201e24f8c4913ae531addf - enabled: 0 @@ -44,7 +44,7 @@ EditorBuildSettings: - enabled: 0 path: Assets/Scenes/BlockDrop.unity guid: a99fde5053c68e0478ef4665b9c7b510 - - enabled: 1 + - enabled: 0 path: Assets/Scenes/SkyWalker.unity guid: 71a02188e9a650b47a6c28ddde2142d6 - enabled: 0 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index fa84002..e86cb26 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -44,10 +44,10 @@ PlayerSettings: m_HolographicTrackingLossScreen: {fileID: 0} defaultScreenWidth: 1920 defaultScreenHeight: 1080 - defaultScreenWidthWeb: 960 - defaultScreenHeightWeb: 600 + defaultScreenWidthWeb: 600 + defaultScreenHeightWeb: 960 m_StereoRenderingPath: 0 - m_ActiveColorSpace: 0 + m_ActiveColorSpace: 1 unsupportedMSAAFallback: 0 m_SpriteBatchVertexThreshold: 300 m_MTRendering: 1 @@ -536,7 +536,7 @@ PlayerSettings: m_Automatic: 1 - m_BuildTarget: WebGLSupport m_APIs: 0b000000 - m_Automatic: 0 + m_Automatic: 1 m_BuildTargetVRSettings: - m_BuildTarget: Standalone m_Enabled: 0 @@ -828,7 +828,7 @@ PlayerSettings: webGLWasmArithmeticExceptions: 0 webGLLinkerTarget: 1 webGLThreadsSupport: 0 - webGLDecompressionFallback: 1 + webGLDecompressionFallback: 0 webGLInitialMemorySize: 32 webGLMaximumMemorySize: 2048 webGLMemoryGrowthMode: 2