diff --git a/Assets/Prefabs/RootLifetimeScope.prefab b/Assets/Prefabs/RootLifetimeScope.prefab new file mode 100644 index 0000000..4412f5c --- /dev/null +++ b/Assets/Prefabs/RootLifetimeScope.prefab @@ -0,0 +1,50 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &8304424163596944933 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5754733557323264208} + - component: {fileID: 7273189601935488900} + m_Layer: 0 + m_Name: RootLifetimeScope + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5754733557323264208 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8304424163596944933} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.9901776, y: 3.4106257, z: -0.04203772} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &7273189601935488900 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8304424163596944933} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 31d874275d6f4540a21f512df426fa88, type: 3} + m_Name: + m_EditorClassIdentifier: + parentReference: + TypeName: + autoRun: 1 + autoInjectGameObjects: [] diff --git a/Assets/Prefabs/RootLifetimeScope.prefab.meta b/Assets/Prefabs/RootLifetimeScope.prefab.meta new file mode 100644 index 0000000..fd72b2a --- /dev/null +++ b/Assets/Prefabs/RootLifetimeScope.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 520a563433527df408515da372ea797f +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Scene_Submission.unity b/Assets/Scenes/Scene_Submission.unity new file mode 100644 index 0000000..79bb11a --- /dev/null +++ b/Assets/Scenes/Scene_Submission.unity @@ -0,0 +1,1048 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 980834270} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &3199142 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3199143} + m_Layer: 0 + m_Name: Scripts + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3199143 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3199142} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -186.96402, y: -1865.763, z: -115.16394} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 376092240} + - {fileID: 1445334646} + - {fileID: 259844899} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &259844896 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 259844899} + - component: {fileID: 259844898} + - component: {fileID: 259844897} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &259844897 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 259844896} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &259844898 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 259844896} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &259844899 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 259844896} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 186.96402, y: 1865.763, z: 115.16394} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 3199143} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &376092239 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 376092240} + - component: {fileID: 376092241} + m_Layer: 0 + m_Name: SC_GameLogic + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &376092240 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376092239} + serializedVersion: 2 + 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: 3199143} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &376092241 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 376092239} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: db185b18195d3814aab9ba4ac5f95047, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &519420028 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 519420032} + - component: {fileID: 519420031} + - component: {fileID: 519420029} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &519420029 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + m_Enabled: 1 +--- !u!20 &519420031 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 2 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 8 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 0 + m_HDR: 1 + m_AllowMSAA: 0 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 0 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &519420032 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 519420028} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 3, y: 6.54, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &544543387 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 544543388} + - component: {fileID: 544543389} + m_Layer: 0 + m_Name: Block_BG01 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &544543388 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 544543387} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 3, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1879498210} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &544543389 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 544543387} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 1231290775 + m_SortingLayer: -1 + m_SortingOrder: -2 + m_Sprite: {fileID: 21300000, guid: b4f992fae349c49468cd4fafe2ba40fb, type: 3} + m_Color: {r: 0, g: 0.07144785, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 1 + m_Size: {x: 7.2, y: 7.2} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &638697048 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 638697049} + - component: {fileID: 638697050} + m_Layer: 0 + m_Name: Block_BG00 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &638697049 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 638697048} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 3, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1879498210} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &638697050 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 638697048} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 1231290775 + m_SortingLayer: -1 + m_SortingOrder: -1 + m_Sprite: {fileID: 21300000, guid: b4f992fae349c49468cd4fafe2ba40fb, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 1 + m_Size: {x: 7, y: 7} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &786657517 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 786657518} + - component: {fileID: 786657520} + - component: {fileID: 786657519} + m_Layer: 5 + m_Name: Txt_Score + m_TagString: UnityObject + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &786657518 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786657517} + 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: 1450061022} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: -245} + m_SizeDelta: {x: 500, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &786657519 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786657517} + 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: 0 + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, 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: 90 + m_fontSizeBase: 90 + m_fontWeight: 400 + m_enableAutoSizing: 0 + 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 &786657520 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 786657517} + m_CullTransparentMesh: 1 +--- !u!850595691 &980834270 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Settings.lighting + serializedVersion: 6 + m_GIWorkflowMode: 1 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 1 + m_BakeBackend: 1 + m_LightmapMaxSize: 1024 + m_BakeResolution: 40 + m_Padding: 2 + m_LightmapCompression: 3 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 2 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 15204, guid: 0000000000000000f000000000000000, type: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 2 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 256 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVREnvironmentSampleCount: 512 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRMinBounces: 2 + m_PVREnvironmentImportanceSampling: 0 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_PVRTiledBaking: 0 + m_NumRaysToShootPerTexel: -1 + m_RespectSceneVisibilityWhenBakingGI: 0 +--- !u!1 &1136728300 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1136728301} + - component: {fileID: 1136728302} + m_Layer: 0 + m_Name: Block_BG02 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1136728301 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1136728300} + serializedVersion: 2 + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 3, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1879498210} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &1136728302 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1136728300} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 0 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} + 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: 0 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 1231290775 + m_SortingLayer: -1 + m_SortingOrder: -3 + m_Sprite: {fileID: 21300000, guid: b4f992fae349c49468cd4fafe2ba40fb, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 1 + m_Size: {x: 7.4, y: 7.4} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &1445334645 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1445334646} + - component: {fileID: 1445334647} + m_Layer: 0 + m_Name: SC_GameVariables + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1445334646 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1445334645} + serializedVersion: 2 + 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: 3199143} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1445334647 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1445334645} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3b3b891bcdf21df4ab82ea34c3afc99e, type: 3} + m_Name: + m_EditorClassIdentifier: + bgTilePrefabs: {fileID: 2914066502361773997, guid: 3f39182b81f944a4d93213431acb41c3, + type: 3} + bomb: {fileID: 7728721766547317714, guid: aa0291e650b382941875040db9e8a232, type: 3} + gems: + - {fileID: -7932498854989450506, guid: 724e93e48c6cc0b4ab3d44e5ea34f2ec, type: 3} + - {fileID: 1972979191936378847, guid: 784323496d719684cb6201b200b95864, type: 3} + - {fileID: 3416069867743778491, guid: 93bd623174244c047af9ce43cc254c32, type: 3} + - {fileID: 8289337781777951430, guid: 473855e3d0d3c8143836b678c9a1b8b5, type: 3} + - {fileID: 4372168081761593873, guid: 91ba2370328500d4db689dad894b1602, type: 3} + bonusAmount: 0.5 + bombChance: 3 + dropHeight: 1 + gemSpeed: 7 + scoreSpeed: 5 + rowsSize: 7 + colsSize: 7 +--- !u!1 &1450061018 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1450061022} + - component: {fileID: 1450061021} + - component: {fileID: 1450061020} + - component: {fileID: 1450061019} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1450061019 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450061018} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1450061020 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450061018} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 1 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 1170, y: 2532} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &1450061021 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450061018} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1450061022 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1450061018} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 786657518} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1740955908 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1740955909} + m_Layer: 0 + m_Name: GemsHolder + m_TagString: UnityObject + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1740955909 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1740955908} + serializedVersion: 2 + 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: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1879498208 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1879498210} + m_Layer: 0 + m_Name: Board + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1879498210 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1879498208} + serializedVersion: 2 + 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: 638697049} + - {fileID: 544543388} + - {fileID: 1136728301} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 519420032} + - {fileID: 1879498210} + - {fileID: 1740955909} + - {fileID: 1450061022} + - {fileID: 3199143} diff --git a/Assets/Scenes/Scene_Submission.unity.meta b/Assets/Scenes/Scene_Submission.unity.meta new file mode 100644 index 0000000..22a9051 --- /dev/null +++ b/Assets/Scenes/Scene_Submission.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d6202ed78c922cf47bf0ea38f735a1bd +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Enums.meta b/Assets/Scripts/Enums.meta new file mode 100644 index 0000000..a219f3e --- /dev/null +++ b/Assets/Scripts/Enums.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f519e21b55b24d3dab3c35c228057972 +timeCreated: 1765661373 \ No newline at end of file diff --git a/Assets/Scripts/Enums/Enums.cs b/Assets/Scripts/Enums/Enums.cs new file mode 100644 index 0000000..8fbc880 --- /dev/null +++ b/Assets/Scripts/Enums/Enums.cs @@ -0,0 +1,15 @@ +namespace Enums { + public enum GemType{ + Blue, + Green, + Red, + Yellow, + Purple, + Bomb + } + + public enum GameState { + Wait, + Move + } +} \ No newline at end of file diff --git a/Assets/Scripts/Enums/Enums.cs.meta b/Assets/Scripts/Enums/Enums.cs.meta new file mode 100644 index 0000000..4fb86e2 --- /dev/null +++ b/Assets/Scripts/Enums/Enums.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 827aa06575984dfaa4234fca3fb70532 +timeCreated: 1765661384 \ No newline at end of file diff --git a/Assets/Scripts/GameBoard.cs b/Assets/Scripts/GameBoard.cs index 9b7a4d6..99a8e00 100644 --- a/Assets/Scripts/GameBoard.cs +++ b/Assets/Scripts/GameBoard.cs @@ -2,16 +2,21 @@ using System.Collections.Generic; using System.Linq; using UnityEngine; +using Enums; +//Done, moved to MatchService and GameBoard public class GameBoard { + // - sets size of the grid + // - handles the score + // - holds the current matches #region Variables private int height = 0; - public int Height { get { return height; } } + public int Height { get { return this.height; } } private int width = 0; - public int Width { get { return width; } } + public int Width { get { return this.width; } } private SC_Gem[,] allGems; // public Gem[,] AllGems { get { return allGems; } } @@ -19,62 +24,68 @@ public class GameBoard private int score = 0; public int Score { - get { return score; } - set { score = value; } + get { return this.score; } + set { + this.score = value; } } private List currentMatches = new List(); - public List CurrentMatches { get { return currentMatches; } } + public List CurrentMatches { get { return this.currentMatches; } } #endregion public GameBoard(int _Width, int _Height) { - height = _Height; - width = _Width; - allGems = new SC_Gem[width, height]; + this.height = _Height; + this.width = _Width; + this.allGems = new SC_Gem[this.width, this.height]; } + + //checks if there are 3 gems of the same type next to each other + //used during setup to avoid matches on game start + //MatchService public bool MatchesAt(Vector2Int _PositionToCheck, SC_Gem _GemToCheck) { if (_PositionToCheck.x > 1) { - if (allGems[_PositionToCheck.x - 1, _PositionToCheck.y].type == _GemToCheck.type && - allGems[_PositionToCheck.x - 2, _PositionToCheck.y].type == _GemToCheck.type) + if (this.allGems[_PositionToCheck.x - 1, _PositionToCheck.y].type == _GemToCheck.type && this.allGems[_PositionToCheck.x - 2, _PositionToCheck.y].type == _GemToCheck.type) return true; } if (_PositionToCheck.y > 1) { - if (allGems[_PositionToCheck.x, _PositionToCheck.y - 1].type == _GemToCheck.type && - allGems[_PositionToCheck.x, _PositionToCheck.y - 2].type == _GemToCheck.type) + if (this.allGems[_PositionToCheck.x, _PositionToCheck.y - 1].type == _GemToCheck.type && this.allGems[_PositionToCheck.x, _PositionToCheck.y - 2].type == _GemToCheck.type) return true; } return false; } + //places the gem in the 2d array public void SetGem(int _X, int _Y, SC_Gem _Gem) { - allGems[_X, _Y] = _Gem; + this.allGems[_X, _Y] = _Gem; } + public SC_Gem GetGem(int _X,int _Y) { - return allGems[_X, _Y]; + return this.allGems[_X, _Y]; } + //MatchService public void FindAllMatches() { - currentMatches.Clear(); + this.currentMatches.Clear(); - for (int x = 0; x < width; x++) - for (int y = 0; y < height; y++) + for (int x = 0; x < this.width; x++) + for (int y = 0; y < this.height; y++) { - SC_Gem currentGem = allGems[x, y]; + SC_Gem currentGem = this.allGems[x, y]; if (currentGem != null) { - if (x > 0 && x < width - 1) + if (x > 0 && x < this.width - 1) { - SC_Gem leftGem = allGems[x - 1, y]; - SC_Gem rightGem = allGems[x + 1, y]; + SC_Gem leftGem = this.allGems[x - 1, y]; + SC_Gem rightGem = this.allGems[x + 1, y]; //checking no empty spots if (leftGem != null && rightGem != null) { @@ -84,17 +95,17 @@ public class GameBoard currentGem.isMatch = true; leftGem.isMatch = true; rightGem.isMatch = true; - currentMatches.Add(currentGem); - currentMatches.Add(leftGem); - currentMatches.Add(rightGem); + this.currentMatches.Add(currentGem); + this.currentMatches.Add(leftGem); + this.currentMatches.Add(rightGem); } } } - if (y > 0 && y < height - 1) + if (y > 0 && y < this.height - 1) { - SC_Gem aboveGem = allGems[x, y - 1]; - SC_Gem bellowGem = allGems[x, y + 1]; + SC_Gem aboveGem = this.allGems[x, y - 1]; + SC_Gem bellowGem = this.allGems[x, y + 1]; //checking no empty spots if (aboveGem != null && bellowGem != null) { @@ -104,51 +115,50 @@ public class GameBoard currentGem.isMatch = true; aboveGem.isMatch = true; bellowGem.isMatch = true; - currentMatches.Add(currentGem); - currentMatches.Add(aboveGem); - currentMatches.Add(bellowGem); + this.currentMatches.Add(currentGem); + this.currentMatches.Add(aboveGem); + this.currentMatches.Add(bellowGem); } } } } } - if (currentMatches.Count > 0) - currentMatches = currentMatches.Distinct().ToList(); + if (this.currentMatches.Count > 0) this.currentMatches = this.currentMatches.Distinct().ToList(); CheckForBombs(); } public void CheckForBombs() { - for (int i = 0; i < currentMatches.Count; i++) + for (int i = 0; i < this.currentMatches.Count; i++) { - SC_Gem gem = currentMatches[i]; + SC_Gem gem = this.currentMatches[i]; int x = gem.posIndex.x; int y = gem.posIndex.y; if (gem.posIndex.x > 0) { - if (allGems[x - 1, y] != null && allGems[x - 1, y].type == GlobalEnums.GemType.bomb) - MarkBombArea(new Vector2Int(x - 1, y), allGems[x - 1, y].blastSize); + if (this.allGems[x - 1, y] != null && this.allGems[x - 1, y].type == GemType.Bomb) + MarkBombArea(new Vector2Int(x - 1, y), this.allGems[x - 1, y].blastSize); } - if (gem.posIndex.x + 1 < width) + if (gem.posIndex.x + 1 < this.width) { - if (allGems[x + 1, y] != null && allGems[x + 1, y].type == GlobalEnums.GemType.bomb) - MarkBombArea(new Vector2Int(x + 1, y), allGems[x + 1, y].blastSize); + if (this.allGems[x + 1, y] != null && this.allGems[x + 1, y].type == GemType.Bomb) + MarkBombArea(new Vector2Int(x + 1, y), this.allGems[x + 1, y].blastSize); } if (gem.posIndex.y > 0) { - if (allGems[x, y - 1] != null && allGems[x, y - 1].type == GlobalEnums.GemType.bomb) - MarkBombArea(new Vector2Int(x, y - 1), allGems[x, y - 1].blastSize); + if (this.allGems[x, y - 1] != null && this.allGems[x, y - 1].type == GemType.Bomb) + MarkBombArea(new Vector2Int(x, y - 1), this.allGems[x, y - 1].blastSize); } - if (gem.posIndex.y + 1 < height) + if (gem.posIndex.y + 1 < this.height) { - if (allGems[x, y + 1] != null && allGems[x, y + 1].type == GlobalEnums.GemType.bomb) - MarkBombArea(new Vector2Int(x, y + 1), allGems[x, y + 1].blastSize); + if (this.allGems[x, y + 1] != null && this.allGems[x, y + 1].type == GemType.Bomb) + MarkBombArea(new Vector2Int(x, y + 1), this.allGems[x, y + 1].blastSize); } } } @@ -160,18 +170,19 @@ public class GameBoard { for (int y = bombPos.y - _BlastSize; y <= bombPos.y + _BlastSize; y++) { - if (x >= 0 && x < width && y >= 0 && y < height) + if (x >= 0 && x < this.width && y >= 0 && y < this.height) { - if (allGems[x, y] != null) + if (this.allGems[x, y] != null) { _print += "(" + x + "," + y + ")" + System.Environment.NewLine; - allGems[x, y].isMatch = true; - currentMatches.Add(allGems[x, y]); + this.allGems[x, y].isMatch = true; + this.currentMatches.Add(this.allGems[x, y]); } } } } - currentMatches = currentMatches.Distinct().ToList(); + + this.currentMatches = this.currentMatches.Distinct().ToList(); } } diff --git a/Assets/Scripts/GlobalEnums.cs b/Assets/Scripts/GlobalEnums.cs deleted file mode 100644 index 4caf83b..0000000 --- a/Assets/Scripts/GlobalEnums.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class GlobalEnums : MonoBehaviour -{ - public enum GemType { blue, green, red, yellow, purple, bomb }; - public enum GameState { wait, move } -} diff --git a/Assets/Scripts/GlobalEnums.cs.meta b/Assets/Scripts/GlobalEnums.cs.meta deleted file mode 100644 index fa77e8a..0000000 --- a/Assets/Scripts/GlobalEnums.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e9f1d6e2be833b1469e3565a3c5290af -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Models.meta b/Assets/Scripts/Models.meta new file mode 100644 index 0000000..3fdc8c7 --- /dev/null +++ b/Assets/Scripts/Models.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5f5c654abc6e4144ab16f8419579ee78 +timeCreated: 1765649284 \ No newline at end of file diff --git a/Assets/Scripts/Models/GameBoard.cs b/Assets/Scripts/Models/GameBoard.cs new file mode 100644 index 0000000..a807444 --- /dev/null +++ b/Assets/Scripts/Models/GameBoard.cs @@ -0,0 +1,27 @@ +using Models.Interfaces; +using UnityEngine; + +namespace Services { + public class GameBoard : IGameBoard { + private int height, width; + public int Height => this.height; + public int Width => this.width; + private Gem[,] gemsGrid; + public Gem[,] GemsGrid => this.gemsGrid; + + public GameBoard(int width, int height) { + this.height = height; + this.width = width; + this.gemsGrid = new Gem[width, height]; + } + + public Gem GetGemAt(Vector2Int pos) { + Gem gameObject = this.gemsGrid[pos.x, pos.y]; + return gameObject != null ? gameObject : null; + } + + public void SetGemAt(Vector2Int pos, Gem gameObject) { + this.gemsGrid[pos.x, pos.y] = gameObject; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Models/GameBoard.cs.meta b/Assets/Scripts/Models/GameBoard.cs.meta new file mode 100644 index 0000000..d054273 --- /dev/null +++ b/Assets/Scripts/Models/GameBoard.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 6a1125aa75474479a9ca0d8de4f6887c +timeCreated: 1765644440 \ No newline at end of file diff --git a/Assets/Scripts/Models/Gem.cs b/Assets/Scripts/Models/Gem.cs new file mode 100644 index 0000000..8289e44 --- /dev/null +++ b/Assets/Scripts/Models/Gem.cs @@ -0,0 +1,26 @@ +using Enums; +using UnityEngine; + +namespace Services { + public class Gem { + private GemType type; + private Vector2Int position; + + public GemType Type => this.type; + public Vector2Int Position => this.position; + + private int scoreValue; + public int ScoreValue => this.scoreValue; + + public bool isMatch = false; + + public Gem(GemType type, Vector2Int position) { + this.type = type; + this.position = position; + } + + public void SetPosition(Vector2Int position) { + this.position = position; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Models/Gem.cs.meta b/Assets/Scripts/Models/Gem.cs.meta new file mode 100644 index 0000000..e06fdf9 --- /dev/null +++ b/Assets/Scripts/Models/Gem.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f3821a37fdec454f999de640213aa95e +timeCreated: 1765649448 \ No newline at end of file diff --git a/Assets/Scripts/Models/Interfaces.meta b/Assets/Scripts/Models/Interfaces.meta new file mode 100644 index 0000000..5abf3f7 --- /dev/null +++ b/Assets/Scripts/Models/Interfaces.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: a806e20251e7471e8b7fd9d80c7d95a6 +timeCreated: 1765649292 \ No newline at end of file diff --git a/Assets/Scripts/Models/Interfaces/IGameBoard.cs b/Assets/Scripts/Models/Interfaces/IGameBoard.cs new file mode 100644 index 0000000..25bf12d --- /dev/null +++ b/Assets/Scripts/Models/Interfaces/IGameBoard.cs @@ -0,0 +1,12 @@ +using Services; +using UnityEngine; + +namespace Models.Interfaces { + public interface IGameBoard { + int Width { get; } + int Height { get; } + Gem[,] GemsGrid { get; } + Gem GetGemAt(Vector2Int pos); + void SetGemAt(Vector2Int pos, Gem gameObject); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Models/Interfaces/IGameBoard.cs.meta b/Assets/Scripts/Models/Interfaces/IGameBoard.cs.meta new file mode 100644 index 0000000..841ce70 --- /dev/null +++ b/Assets/Scripts/Models/Interfaces/IGameBoard.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 83a1cf6a985d4d7092f2fc9044fbab8c +timeCreated: 1765632691 \ No newline at end of file diff --git a/Assets/Scripts/Mono/GO_Gem.cs b/Assets/Scripts/Mono/GO_Gem.cs deleted file mode 100644 index 4573121..0000000 --- a/Assets/Scripts/Mono/GO_Gem.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -public class GO_Gem : MonoBehaviour { - private Rigidbody rigidBody; - - private void Awake() - { - this.rigidBody = GetComponent(); - } - - public void Spawn() { - this.gameObject.SetActive(true); - } - - public void Return() { - this.gameObject.SetActive(false); - } -} diff --git a/Assets/Scripts/Mono/GO_Gem.cs.meta b/Assets/Scripts/Mono/GO_Gem.cs.meta deleted file mode 100644 index b140523..0000000 --- a/Assets/Scripts/Mono/GO_Gem.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 247ae442234d0de449a27a3ac5d46cf4 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/SC_GameLogic.cs b/Assets/Scripts/SC_GameLogic.cs index 28b7e04..6a764c2 100644 --- a/Assets/Scripts/SC_GameLogic.cs +++ b/Assets/Scripts/SC_GameLogic.cs @@ -2,15 +2,16 @@ using System.Collections.Generic; using TMPro; using UnityEngine; +using Enums; public class SC_GameLogic : MonoBehaviour { - private Dictionary unityObjects; - private int score = 0; - private float displayScore = 0; - private GameBoard gameBoard; - private GlobalEnums.GameState currentState = GlobalEnums.GameState.move; - public GlobalEnums.GameState CurrentState { get { return currentState; } } + private Dictionary unityObjects; //this is a dictionary of all game objects in the scene + private int score = 0; //current score + private float displayScore = 0; //for animation, i think + private GameBoard gameBoard; //game board object + private GameState currentState = GameState.Move; //current game state + public GameState CurrentState { get { return this.currentState; } } #region MonoBehaviour private void Awake() @@ -25,36 +26,37 @@ public class SC_GameLogic : MonoBehaviour private void Update() { - displayScore = Mathf.Lerp(displayScore, gameBoard.Score, SC_GameVariables.Instance.scoreSpeed * Time.deltaTime); - unityObjects["Txt_Score"].GetComponent().text = displayScore.ToString("0"); + this.displayScore = Mathf.Lerp(this.displayScore, this.gameBoard.Score, SC_GameVariables.Instance.scoreSpeed * Time.deltaTime); + this.unityObjects["Txt_Score"].GetComponent().text = this.displayScore.ToString("0"); } #endregion #region Logic private void Init() { - unityObjects = new Dictionary(); + this.unityObjects = new Dictionary(); GameObject[] _obj = GameObject.FindGameObjectsWithTag("UnityObject"); - foreach (GameObject g in _obj) - unityObjects.Add(g.name,g); + foreach (GameObject g in _obj) this.unityObjects.Add(g.name,g); - gameBoard = new GameBoard(7, 7); + this.gameBoard = new GameBoard(7, 7); Setup(); } + + //GameBoardService private void Setup() { - for (int x = 0; x < gameBoard.Width; x++) - for (int y = 0; y < gameBoard.Height; y++) + for (int x = 0; x < this.gameBoard.Width; x++) + for (int y = 0; y < this.gameBoard.Height; y++) { Vector2 _pos = new Vector2(x, y); GameObject _bgTile = Instantiate(SC_GameVariables.Instance.bgTilePrefabs, _pos, Quaternion.identity); - _bgTile.transform.SetParent(unityObjects["GemsHolder"].transform); + _bgTile.transform.SetParent(this.unityObjects["GemsHolder"].transform); _bgTile.name = "BG Tile - " + x + ", " + y; int _gemToUse = Random.Range(0, SC_GameVariables.Instance.gems.Length); int iterations = 0; - while (gameBoard.MatchesAt(new Vector2Int(x, y), SC_GameVariables.Instance.gems[_gemToUse]) && iterations < 100) + while (this.gameBoard.MatchesAt(new Vector2Int(x, y), SC_GameVariables.Instance.gems[_gemToUse]) && iterations < 100) { _gemToUse = Random.Range(0, SC_GameVariables.Instance.gems.Length); iterations++; @@ -64,52 +66,64 @@ public class SC_GameLogic : MonoBehaviour } public void StartGame() { - unityObjects["Txt_Score"].GetComponent().text = score.ToString("0"); + this.unityObjects["Txt_Score"].GetComponent().text = this.score.ToString("0"); } + + //GameBoardService private void SpawnGem(Vector2Int _Position, SC_Gem _GemToSpawn) { if (Random.Range(0, 100f) < SC_GameVariables.Instance.bombChance) _GemToSpawn = SC_GameVariables.Instance.bomb; SC_Gem _gem = Instantiate(_GemToSpawn, new Vector3(_Position.x, _Position.y + SC_GameVariables.Instance.dropHeight, 0f), Quaternion.identity); - _gem.transform.SetParent(unityObjects["GemsHolder"].transform); + _gem.transform.SetParent(this.unityObjects["GemsHolder"].transform); _gem.name = "Gem - " + _Position.x + ", " + _Position.y; - gameBoard.SetGem(_Position.x,_Position.y, _gem); + this.gameBoard.SetGem(_Position.x,_Position.y, _gem); _gem.SetupGem(this,_Position); } + + //GameBoardService public void SetGem(int _X,int _Y, SC_Gem _Gem) { - gameBoard.SetGem(_X,_Y, _Gem); + this.gameBoard.SetGem(_X,_Y, _Gem); } + + //GameBoardService public SC_Gem GetGem(int _X, int _Y) { - return gameBoard.GetGem(_X, _Y); + return this.gameBoard.GetGem(_X, _Y); } - public void SetState(GlobalEnums.GameState _CurrentState) + public void SetState(GameState _CurrentState) { - currentState = _CurrentState; + this.currentState = _CurrentState; } + + //GameBoardService public void DestroyMatches() { - for (int i = 0; i < gameBoard.CurrentMatches.Count; i++) - if (gameBoard.CurrentMatches[i] != null) + for (int i = 0; i < this.gameBoard.CurrentMatches.Count; i++) + if (this.gameBoard.CurrentMatches[i] != null) { - ScoreCheck(gameBoard.CurrentMatches[i]); - DestroyMatchedGemsAt(gameBoard.CurrentMatches[i].posIndex); + ScoreCheck(this.gameBoard.CurrentMatches[i]); + DestroyMatchedGemsAt(this.gameBoard.CurrentMatches[i].posIndex); } StartCoroutine(DecreaseRowCo()); } + + //I think, this moves gems down after a match? + //MoveGemsDown + //GameBoardService private IEnumerator DecreaseRowCo() { yield return new WaitForSeconds(.2f); int nullCounter = 0; - for (int x = 0; x < gameBoard.Width; x++) + for (int x = 0; x < this.gameBoard.Width; x++) { - for (int y = 0; y < gameBoard.Height; y++) + for (int y = 0; y < this.gameBoard.Height; y++) { - SC_Gem _curGem = gameBoard.GetGem(x, y); + SC_Gem _curGem = this.gameBoard.GetGem(x, y); if (_curGem == null) { nullCounter++; @@ -127,13 +141,16 @@ public class SC_GameLogic : MonoBehaviour StartCoroutine(FilledBoardCo()); } + //IScoreService public void ScoreCheck(SC_Gem gemToCheck) { - gameBoard.Score += gemToCheck.scoreValue; + this.gameBoard.Score += gemToCheck.scoreValue; } + + //GameBoardService - DestroyMatchedGems private void DestroyMatchedGemsAt(Vector2Int _Pos) { - SC_Gem _curGem = gameBoard.GetGem(_Pos.x,_Pos.y); + SC_Gem _curGem = this.gameBoard.GetGem(_Pos.x,_Pos.y); if (_curGem != null) { Instantiate(_curGem.destroyEffect, new Vector2(_Pos.x, _Pos.y), Quaternion.identity); @@ -142,14 +159,16 @@ public class SC_GameLogic : MonoBehaviour SetGem(_Pos.x,_Pos.y, null); } } + + //GameBoardService - FillBoard private IEnumerator FilledBoardCo() { yield return new WaitForSeconds(0.5f); RefillBoard(); yield return new WaitForSeconds(0.5f); - gameBoard.FindAllMatches(); - if (gameBoard.CurrentMatches.Count > 0) + this.gameBoard.FindAllMatches(); + if (this.gameBoard.CurrentMatches.Count > 0) { yield return new WaitForSeconds(0.5f); DestroyMatches(); @@ -157,16 +176,18 @@ public class SC_GameLogic : MonoBehaviour else { yield return new WaitForSeconds(0.5f); - currentState = GlobalEnums.GameState.move; + this.currentState = GameState.Move; } } + + //GameBoardService private void RefillBoard() { - for (int x = 0; x < gameBoard.Width; x++) + for (int x = 0; x < this.gameBoard.Width; x++) { - for (int y = 0; y < gameBoard.Height; y++) + for (int y = 0; y < this.gameBoard.Height; y++) { - SC_Gem _curGem = gameBoard.GetGem(x,y); + SC_Gem _curGem = this.gameBoard.GetGem(x,y); if (_curGem == null) { int gemToUse = Random.Range(0, SC_GameVariables.Instance.gems.Length); @@ -176,15 +197,17 @@ public class SC_GameLogic : MonoBehaviour } CheckMisplacedGems(); } + //gets all gem game objects + //if the gem is not in GameBoard, destroy it private void CheckMisplacedGems() { List foundGems = new List(); foundGems.AddRange(FindObjectsOfType()); - for (int x = 0; x < gameBoard.Width; x++) + for (int x = 0; x < this.gameBoard.Width; x++) { - for (int y = 0; y < gameBoard.Height; y++) + for (int y = 0; y < this.gameBoard.Height; y++) { - SC_Gem _curGem = gameBoard.GetGem(x, y); + SC_Gem _curGem = this.gameBoard.GetGem(x, y); if (foundGems.Contains(_curGem)) foundGems.Remove(_curGem); } @@ -195,7 +218,7 @@ public class SC_GameLogic : MonoBehaviour } public void FindAllMatches() { - gameBoard.FindAllMatches(); + this.gameBoard.FindAllMatches(); } #endregion diff --git a/Assets/Scripts/SC_GameVariables.cs b/Assets/Scripts/SC_GameVariables.cs index 0391dbd..839c452 100644 --- a/Assets/Scripts/SC_GameVariables.cs +++ b/Assets/Scripts/SC_GameVariables.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using UnityEngine; +//Done //This is basically just the settings, this can maybe be a ScriptableObject public class SC_GameVariables : MonoBehaviour { diff --git a/Assets/Scripts/SC_Gem.cs b/Assets/Scripts/SC_Gem.cs index 57ef530..66aa0bd 100644 --- a/Assets/Scripts/SC_Gem.cs +++ b/Assets/Scripts/SC_Gem.cs @@ -1,5 +1,6 @@ using System.Collections; using System.Collections.Generic; +using Enums; using UnityEngine; //This is a SINGULAR gem @@ -14,7 +15,7 @@ public class SC_Gem : MonoBehaviour private float swipeAngle = 0; private SC_Gem otherGem; - public GlobalEnums.GemType type; + public GemType type; public bool isMatch = false; private Vector2Int previousPos; public GameObject destroyEffect; @@ -25,19 +26,22 @@ public class SC_Gem : MonoBehaviour void Update() { - if (Vector2.Distance(transform.position, posIndex) > 0.01f) - transform.position = Vector2.Lerp(transform.position, posIndex, SC_GameVariables.Instance.gemSpeed * Time.deltaTime); + //if the current position doesnt match the index in GameBoard, animate it to move to the correct position + //else, we update the GameBoard with the current possition, do we need this every frame???? + if (Vector2.Distance(this.transform.position, this.posIndex) > 0.01f) + this.transform.position = Vector2.Lerp(this.transform.position, this.posIndex, SC_GameVariables.Instance.gemSpeed * Time.deltaTime); else { - transform.position = new Vector3(posIndex.x, posIndex.y, 0); - scGameLogic.SetGem(posIndex.x, posIndex.y, this); + this.transform.position = new Vector3(this.posIndex.x, this.posIndex.y, 0); + this.scGameLogic.SetGem(this.posIndex.x, this.posIndex.y, this); } - if (mousePressed && Input.GetMouseButtonUp(0)) + + if (this.mousePressed && Input.GetMouseButtonUp(0)) { - mousePressed = false; - if (scGameLogic.CurrentState == GlobalEnums.GameState.move) + this.mousePressed = false; + if (this.scGameLogic.CurrentState == GameState.Move) { - finalTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); + this.finalTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); CalculateAngle(); } } @@ -45,63 +49,63 @@ public class SC_Gem : MonoBehaviour public void SetupGem(SC_GameLogic _ScGameLogic,Vector2Int _Position) { - posIndex = _Position; - scGameLogic = _ScGameLogic; + this.posIndex = _Position; + this.scGameLogic = _ScGameLogic; } //Not every gem needs this private void OnMouseDown() { - if (scGameLogic.CurrentState == GlobalEnums.GameState.move) + if (this.scGameLogic.CurrentState == GameState.Move) { - firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); - mousePressed = true; + this.firstTouchPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); + this.mousePressed = true; } } //Not every gem needs this private void CalculateAngle() { - swipeAngle = Mathf.Atan2(finalTouchPosition.y - firstTouchPosition.y, finalTouchPosition.x - firstTouchPosition.x); - swipeAngle = swipeAngle * 180 / Mathf.PI; + this.swipeAngle = Mathf.Atan2(this.finalTouchPosition.y - this.firstTouchPosition.y, this.finalTouchPosition.x - this.firstTouchPosition.x); + this.swipeAngle = this.swipeAngle * 180 / Mathf.PI; - if (Vector3.Distance(firstTouchPosition, finalTouchPosition) > .5f) + if (Vector3.Distance(this.firstTouchPosition, this.finalTouchPosition) > .5f) MovePieces(); } //Not every gem needs this, maybe private void MovePieces() { - previousPos = posIndex; + this.previousPos = this.posIndex; - if (swipeAngle < 45 && swipeAngle > -45 && posIndex.x < SC_GameVariables.Instance.rowsSize - 1) + if (this.swipeAngle < 45 && this.swipeAngle > -45 && this.posIndex.x < SC_GameVariables.Instance.rowsSize - 1) { - otherGem = scGameLogic.GetGem(posIndex.x + 1, posIndex.y); - otherGem.posIndex.x--; - posIndex.x++; + this.otherGem = this.scGameLogic.GetGem(this.posIndex.x + 1, this.posIndex.y); + this.otherGem.posIndex.x--; + this.posIndex.x++; } - else if (swipeAngle > 45 && swipeAngle <= 135 && posIndex.y < SC_GameVariables.Instance.colsSize - 1) + else if (this.swipeAngle > 45 && this.swipeAngle <= 135 && this.posIndex.y < SC_GameVariables.Instance.colsSize - 1) { - otherGem = scGameLogic.GetGem(posIndex.x, posIndex.y + 1); - otherGem.posIndex.y--; - posIndex.y++; + this.otherGem = this.scGameLogic.GetGem(this.posIndex.x, this.posIndex.y + 1); + this.otherGem.posIndex.y--; + this.posIndex.y++; } - else if (swipeAngle < -45 && swipeAngle >= -135 && posIndex.y > 0) + else if (this.swipeAngle < -45 && this.swipeAngle >= -135 && this.posIndex.y > 0) { - otherGem = scGameLogic.GetGem(posIndex.x, posIndex.y - 1); - otherGem.posIndex.y++; - posIndex.y--; + this.otherGem = this.scGameLogic.GetGem(this.posIndex.x, this.posIndex.y - 1); + this.otherGem.posIndex.y++; + this.posIndex.y--; } - else if (swipeAngle > 135 || swipeAngle < -135 && posIndex.x > 0) + else if (this.swipeAngle > 135 || this.swipeAngle < -135 && this.posIndex.x > 0) { - otherGem = scGameLogic.GetGem(posIndex.x - 1, posIndex.y); - otherGem.posIndex.x++; - posIndex.x--; + this.otherGem = this.scGameLogic.GetGem(this.posIndex.x - 1, this.posIndex.y); + this.otherGem.posIndex.x++; + this.posIndex.x--; } - scGameLogic.SetGem(posIndex.x,posIndex.y, this); - scGameLogic.SetGem(otherGem.posIndex.x, otherGem.posIndex.y, otherGem); + this.scGameLogic.SetGem(this.posIndex.x, this.posIndex.y, this); + this.scGameLogic.SetGem(this.otherGem.posIndex.x, this.otherGem.posIndex.y, this.otherGem); StartCoroutine(CheckMoveCo()); } @@ -109,27 +113,27 @@ public class SC_Gem : MonoBehaviour //Why are we checking matches on the Gem itself public IEnumerator CheckMoveCo() { - scGameLogic.SetState(GlobalEnums.GameState.wait); + this.scGameLogic.SetState(GameState.Wait); yield return new WaitForSeconds(.5f); - scGameLogic.FindAllMatches(); + this.scGameLogic.FindAllMatches(); - if (otherGem != null) + if (this.otherGem != null) { - if (isMatch == false && otherGem.isMatch == false) + if (this.isMatch == false && this.otherGem.isMatch == false) { - otherGem.posIndex = posIndex; - posIndex = previousPos; + this.otherGem.posIndex = this.posIndex; + this.posIndex = this.previousPos; - scGameLogic.SetGem(posIndex.x, posIndex.y, this); - scGameLogic.SetGem(otherGem.posIndex.x, otherGem.posIndex.y, otherGem); + this.scGameLogic.SetGem(this.posIndex.x, this.posIndex.y, this); + this.scGameLogic.SetGem(this.otherGem.posIndex.x, this.otherGem.posIndex.y, this.otherGem); yield return new WaitForSeconds(.5f); - scGameLogic.SetState(GlobalEnums.GameState.move); + this.scGameLogic.SetState(GameState.Move); } else { - scGameLogic.DestroyMatches(); + this.scGameLogic.DestroyMatches(); } } } diff --git a/Assets/Scripts/Scopes.meta b/Assets/Scripts/Scopes.meta new file mode 100644 index 0000000..3b0bd63 --- /dev/null +++ b/Assets/Scripts/Scopes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0487a87adc6c17c4596c6b6172a748cf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Scopes/RootLifetimeScope.cs b/Assets/Scripts/Scopes/RootLifetimeScope.cs new file mode 100644 index 0000000..5a866d9 --- /dev/null +++ b/Assets/Scripts/Scopes/RootLifetimeScope.cs @@ -0,0 +1,10 @@ +using VContainer; +using VContainer.Unity; + +namespace Scopes { + public class RootLifetimeScope : LifetimeScope { + protected override void Configure(IContainerBuilder builder) { + + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Scopes/RootLifetimeScope.cs.meta b/Assets/Scripts/Scopes/RootLifetimeScope.cs.meta new file mode 100644 index 0000000..9be6e2d --- /dev/null +++ b/Assets/Scripts/Scopes/RootLifetimeScope.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 31d874275d6f4540a21f512df426fa88 +timeCreated: 1765628841 \ No newline at end of file diff --git a/Assets/Scripts/ScriptableObjects.meta b/Assets/Scripts/ScriptableObjects.meta new file mode 100644 index 0000000..8796d0f --- /dev/null +++ b/Assets/Scripts/ScriptableObjects.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 50912fd71c7e4d5db3823a63c84efe09 +timeCreated: 1765661086 \ No newline at end of file diff --git a/Assets/Scripts/ScriptableObjects/GameVariables.cs b/Assets/Scripts/ScriptableObjects/GameVariables.cs new file mode 100644 index 0000000..6ac8a16 --- /dev/null +++ b/Assets/Scripts/ScriptableObjects/GameVariables.cs @@ -0,0 +1,23 @@ +using UnityEngine; +using Views; + +//Done, moved to GameVariables scriptable object +namespace ScriptableObjects { + [CreateAssetMenu(fileName = "GameVariables", menuName = "Game Variables")] + public class GameVariables : ScriptableObject { + public GameObject bgTilePrefabs; + public GemView bombPrefab; + public GemView[] gemsPrefabs; + public GameObject[] destroyEffectPrefabs; + public float bonusAmount = 0.5f; + public float bombChance = 2f; + public int dropHeight = 1; + public float gemSpeed = 7; + public float scoreSpeed = 5; + + [HideInInspector] + public int rowsSize = 7; + [HideInInspector] + public int colsSize = 7; + } +} \ No newline at end of file diff --git a/Assets/Scripts/ScriptableObjects/GameVariables.cs.meta b/Assets/Scripts/ScriptableObjects/GameVariables.cs.meta new file mode 100644 index 0000000..4387fbc --- /dev/null +++ b/Assets/Scripts/ScriptableObjects/GameVariables.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 9f37e854902a46cb8bd927cf84ab450c +timeCreated: 1765656977 \ No newline at end of file diff --git a/Assets/Scripts/Services/GameBoardService.cs b/Assets/Scripts/Services/GameBoardService.cs new file mode 100644 index 0000000..58fb74c --- /dev/null +++ b/Assets/Scripts/Services/GameBoardService.cs @@ -0,0 +1,188 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Cysharp.Threading.Tasks; +using Enums; +using Models.Interfaces; +using ScriptableObjects; +using Services.Interfaces; +using UnityEngine; +using Views; +using Object = UnityEngine.Object; +using Random = UnityEngine.Random; + +namespace Services { + public class GameBoardService : IGameBoardService { + private IGameBoard gameBoard; + private GameVariables gameVariables; + private IMatchService matchService; + private IScoreService scoreService; + private Transform gemsHolder; + + public GameBoardService(IGameBoard gameBoard, GameVariables gameVariables, IMatchService matchService, IScoreService scoreSerivce, Transform gemsHolder) { + this.gameBoard = gameBoard; + this.gameVariables = gameVariables; + this.matchService = matchService; + this.scoreService = scoreSerivce; + this.gemsHolder = gemsHolder; + } + + private int RandomGemTypeAsInt() { + GemType[] spawnableGems = Enum.GetValues(typeof(GemType)) + .Cast() + .Where(gType => gType != GemType.Bomb) + .ToArray(); + + return Random.Range(0, spawnableGems.Length); + } + + public void Setup() { + for (int x = 0; x < this.gameBoard.Width; x++) + for (int y = 0; y < this.gameBoard.Height; y++) + { + Vector2 position = new Vector2(x, y); + GameObject backgroundTile = Object.Instantiate(this.gameVariables.bgTilePrefabs, position, Quaternion.identity); + backgroundTile.transform.SetParent(this.gemsHolder); + backgroundTile.name = "BG Tile - " + x + ", " + y; + + + + int gemToUse = RandomGemTypeAsInt(); + + int iterations = 0; + while (this.matchService.MatchesAt(new Vector2Int(x, y), (GemType)gemToUse) && iterations < 100) + { + gemToUse = RandomGemTypeAsInt(); + iterations++; + } + + //ToDo: change gameVariables.gemsPrefabs[gemToUse] since gemToUse is index, if the order changes it wont work + SpawnGem(new Vector2Int(x, y), this.gameVariables.gemsPrefabs[gemToUse], (GemType)gemToUse); + } + } + + public void SpawnGem(Vector2Int position, GemView gemPrefab, GemType gemType) { + if (Random.Range(0, 100f) < this.gameVariables.bombChance) + gemPrefab = this.gameVariables.bombPrefab; + + GemView gemView = Object.Instantiate(gemPrefab, new Vector3(position.x, position.y + this.gameVariables.dropHeight, 0f), Quaternion.identity); + gemView.transform.SetParent(this.gemsHolder); + gemView.name = "Gem - " + position.x + ", " + position.y; + SetGem(new Vector2Int(position.x,position.y), new Gem(gemType, position)); + } + + public void SetGem(Vector2Int position, Gem gem) { + this.gameBoard.SetGemAt(new Vector2Int(position.x, position.y), gem); + } + + public Gem GetGem(Vector2Int position) { + return this.gameBoard.GetGemAt(position); + } + + public void DestroyMatches() { + for (int i = 0; i < this.matchService.CurrentMatches.Count; i++) + if (this.matchService.CurrentMatches[i] != null) + { + this.scoreService.ScoreCheck(this.matchService.CurrentMatches[i].ScoreValue); + DestroyMatchedGems(this.matchService.CurrentMatches[i].Position); + } + + MoveGemsDown(); + } + + public async UniTask MoveGemsDown() { + await UniTask.Delay(2); + // why the delay though? + // yield return new WaitForSeconds(.2f); + + int nullCounter = 0; + for (int x = 0; x < this.gameBoard.Width; x++) + { + for (int y = 0; y < this.gameBoard.Height; y++) + { + Gem currentGem = this.gameBoard.GetGemAt(new Vector2Int(x, y)); + if (currentGem == null) + { + nullCounter++; + } + else if (nullCounter > 0) + { + currentGem.SetPosition(new Vector2Int(currentGem.Position.x, currentGem.Position.y - nullCounter)); + SetGem(currentGem.Position, currentGem); + SetGem(new Vector2Int(x,y), null); + } + } + nullCounter = 0; + } + } + + public async UniTask FillBoard() { + await UniTask.Delay(5); + RefillBoard(); + await UniTask.Delay(5); + this.matchService.FindAllMatches(); + if (this.matchService.CurrentMatches.Count > 0) + { + await UniTask.Delay(5); + DestroyMatches(); + } + else + { + await UniTask.Delay(5); + // currentState = GameState.Move; + } + } + + public void RefillBoard() { + for (int x = 0; x < this.gameBoard.Width; x++) + { + for (int y = 0; y < this.gameBoard.Height; y++) + { + Gem currentGem = this.gameBoard.GetGemAt(new Vector2Int(x,y)); + if (currentGem == null) { + int gemToUse = RandomGemTypeAsInt(); + SpawnGem(new Vector2Int(x, y), this.gameVariables.gemsPrefabs[gemToUse], (GemType)gemToUse); + } + } + } + CheckMisplacedGems(); + } + + public void CheckMisplacedGems() { + List gemsViews = GemsViews(); + + for (int x = 0; x < this.gameBoard.Width; x++) + { + for (int y = 0; y < this.gameBoard.Height; y++) + { + Gem currentGem = this.gameBoard.GetGemAt(new Vector2Int(x,y)); + GemView gemView = gemsViews.FirstOrDefault(gv => gv.Gem == currentGem); + + if (gemView != null) { + gemsViews.Remove(gemView); + } + } + } + + foreach (GemView g in gemsViews) + Object.Destroy(g.gameObject); + } + + public void DestroyMatchedGems(Vector2Int position) { + List gemsViews = GemsViews(); + Gem currentGem = this.gameBoard.GetGemAt(position); + if (currentGem != null) + { + GemView gemView = gemsViews.FirstOrDefault(gv => gv.Gem == currentGem); + Object.Instantiate(this.gameVariables.destroyEffectPrefabs[(int)currentGem.Type], new Vector2(position.x, position.y), Quaternion.identity); + + Object.Destroy(gemView!.gameObject); + SetGem(position, null); + } + } + + private List GemsViews() { + return this.gemsHolder.GetComponentsInChildren().ToList(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Services/GameBoardService.cs.meta b/Assets/Scripts/Services/GameBoardService.cs.meta new file mode 100644 index 0000000..ddfb329 --- /dev/null +++ b/Assets/Scripts/Services/GameBoardService.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 1e52d701a54645898c36c3f407ac890f +timeCreated: 1765664126 \ No newline at end of file diff --git a/Assets/Scripts/Services/Interfaces/IGameBoardService.cs b/Assets/Scripts/Services/Interfaces/IGameBoardService.cs new file mode 100644 index 0000000..0d19414 --- /dev/null +++ b/Assets/Scripts/Services/Interfaces/IGameBoardService.cs @@ -0,0 +1,19 @@ +using Cysharp.Threading.Tasks; +using Enums; +using UnityEngine; +using Views; + +namespace Services.Interfaces { + public interface IGameBoardService { + void Setup(); + void SpawnGem(Vector2Int position, GemView gemPrefab, GemType gemType); + void SetGem(Vector2Int position, Gem gem); + Gem GetGem(Vector2Int position); + void DestroyMatches(); + UniTask MoveGemsDown(); + UniTask FillBoard(); + void RefillBoard(); + void CheckMisplacedGems(); + void DestroyMatchedGems(Vector2Int position); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Services/Interfaces/IGameBoardService.cs.meta b/Assets/Scripts/Services/Interfaces/IGameBoardService.cs.meta new file mode 100644 index 0000000..bce3a58 --- /dev/null +++ b/Assets/Scripts/Services/Interfaces/IGameBoardService.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c63053069b7e4791a82ee7dd04eae86c +timeCreated: 1765662196 \ No newline at end of file diff --git a/Assets/Scripts/Services/Interfaces/IInputService.cs b/Assets/Scripts/Services/Interfaces/IInputService.cs new file mode 100644 index 0000000..9f1c6ce --- /dev/null +++ b/Assets/Scripts/Services/Interfaces/IInputService.cs @@ -0,0 +1,9 @@ +using System; +using UnityEngine; + +namespace Services.Interfaces { + public interface IInputService { + event Action OnPointerDown; + event Action OnPointerUp; + } +} \ No newline at end of file diff --git a/Assets/Scripts/Services/Interfaces/IInputService.cs.meta b/Assets/Scripts/Services/Interfaces/IInputService.cs.meta new file mode 100644 index 0000000..d16fa0a --- /dev/null +++ b/Assets/Scripts/Services/Interfaces/IInputService.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 73b706bb5eea4fdf9b1f4563aef578cd +timeCreated: 1765632542 \ No newline at end of file diff --git a/Assets/Scripts/Services/Interfaces/IMatchService.cs b/Assets/Scripts/Services/Interfaces/IMatchService.cs new file mode 100644 index 0000000..717105f --- /dev/null +++ b/Assets/Scripts/Services/Interfaces/IMatchService.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; +using UnityEngine; +using Enums; + +namespace Services.Interfaces { + public interface IMatchService { + List CurrentMatches { get; } + bool MatchesAt(Vector2Int positionToCheck, GemType gemTypeToCheck); + void FindAllMatches(); + void CheckForBombs(); + void MarkBombArea(Vector2Int bombPosition, int blastSize); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Services/Interfaces/IMatchService.cs.meta b/Assets/Scripts/Services/Interfaces/IMatchService.cs.meta new file mode 100644 index 0000000..4485bc9 --- /dev/null +++ b/Assets/Scripts/Services/Interfaces/IMatchService.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 513ff6c9b21549f088abcb4c83143771 +timeCreated: 1765656570 \ No newline at end of file diff --git a/Assets/Scripts/Services/Interfaces/IScoreService.cs b/Assets/Scripts/Services/Interfaces/IScoreService.cs new file mode 100644 index 0000000..89aa549 --- /dev/null +++ b/Assets/Scripts/Services/Interfaces/IScoreService.cs @@ -0,0 +1,5 @@ +namespace Services.Interfaces { + public interface IScoreService { + void ScoreCheck(int value); + } +} \ No newline at end of file diff --git a/Assets/Scripts/Services/Interfaces/IScoreService.cs.meta b/Assets/Scripts/Services/Interfaces/IScoreService.cs.meta new file mode 100644 index 0000000..9acbcd6 --- /dev/null +++ b/Assets/Scripts/Services/Interfaces/IScoreService.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8d61c21960f14353b3f431434d3b4de2 +timeCreated: 1765674663 \ No newline at end of file diff --git a/Assets/Scripts/Services/MatchService.cs b/Assets/Scripts/Services/MatchService.cs new file mode 100644 index 0000000..13d5395 --- /dev/null +++ b/Assets/Scripts/Services/MatchService.cs @@ -0,0 +1,99 @@ +using System.Collections.Generic; +using System.Linq; +using Enums; +using Services.Interfaces; +using UnityEngine; + +namespace Services { + public class MatchService : IMatchService { + private List currentMatches = new List(); + public List CurrentMatches => this.currentMatches; + + private GameBoard gameBoard; + + public MatchService(GameBoard gameBoard) { + this.gameBoard = gameBoard; + } + + public bool MatchesAt(Vector2Int positionToCheck, GemType gemTypeToCheck) { + Gem[,] gems = this.gameBoard.GemsGrid; + if (positionToCheck.x > 1) + { + if (gems[positionToCheck.x - 1, positionToCheck.y].Type == gemTypeToCheck && gems[positionToCheck.x - 2, positionToCheck.y].Type == gemTypeToCheck) + return true; + } + + if (positionToCheck.y > 1) + { + if (gems[positionToCheck.x, positionToCheck.y - 1].Type == gemTypeToCheck && gems[positionToCheck.x, positionToCheck.y - 2].Type == gemTypeToCheck) + return true; + } + + return false; + } + + public void FindAllMatches() { + this.currentMatches.Clear(); + + for (int x = 0; x < this.gameBoard.Width; x++) + for (int y = 0; y < this.gameBoard.Height; y++) + { + Gem currentGem = this.gameBoard.GemsGrid[x, y]; + if (currentGem != null) + { + if (x > 0 && x < this.gameBoard.Width - 1) + { + Gem leftGem = this.gameBoard.GemsGrid[x - 1, y]; + Gem rightGem = this.gameBoard.GemsGrid[x + 1, y]; + //checking no empty spots + if (leftGem != null && rightGem != null) + { + //Match + if (leftGem.Type == currentGem.Type && rightGem.Type == currentGem.Type) + { + currentGem.isMatch = true; + leftGem.isMatch = true; + rightGem.isMatch = true; + this.currentMatches.Add(currentGem); + this.currentMatches.Add(leftGem); + this.currentMatches.Add(rightGem); + } + } + } + + if (y > 0 && y < this.gameBoard.Height - 1) + { + Gem aboveGem = this.gameBoard.GemsGrid[x, y - 1]; + Gem bellowGem = this.gameBoard.GemsGrid[x, y + 1]; + //checking no empty spots + if (aboveGem != null && bellowGem != null) + { + //Match + if (aboveGem.Type == currentGem.Type && bellowGem.Type == currentGem.Type) + { + currentGem.isMatch = true; + aboveGem.isMatch = true; + bellowGem.isMatch = true; + this.currentMatches.Add(currentGem); + this.currentMatches.Add(aboveGem); + this.currentMatches.Add(bellowGem); + } + } + } + } + } + + if (this.currentMatches.Count > 0) this.currentMatches = this.currentMatches.Distinct().ToList(); + + CheckForBombs(); + } + + public void CheckForBombs() { + throw new System.NotImplementedException(); + } + + public void MarkBombArea(Vector2Int bombPosition, int blastSize) { + throw new System.NotImplementedException(); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Services/MatchService.cs.meta b/Assets/Scripts/Services/MatchService.cs.meta new file mode 100644 index 0000000..2c7ac80 --- /dev/null +++ b/Assets/Scripts/Services/MatchService.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 0fca077f5e14456ab09ae9ea6bca7c61 +timeCreated: 1765665318 \ No newline at end of file diff --git a/Assets/Scripts/Services/ObjectPoolService.cs b/Assets/Scripts/Services/ObjectPoolService.cs index fdc9db8..80c76b8 100644 --- a/Assets/Scripts/Services/ObjectPoolService.cs +++ b/Assets/Scripts/Services/ObjectPoolService.cs @@ -2,22 +2,23 @@ using System.Collections; using System.Collections.Generic; using Services.Interfaces; using UnityEngine; +using Views; namespace Services { - public class ObjectPoolService:IObjectPool { - private readonly GameObject prefab; + public class ObjectPoolService:IObjectPool { + private readonly GemView prefab; private readonly Transform parent; private readonly int size; - private readonly Stack pool = new Stack(); + private readonly Stack pool = new Stack(); - public ObjectPoolService(GameObject prefab, Transform parent, int size = 5) { + public ObjectPoolService(GemView prefab, Transform parent, int size = 5) { this.prefab = prefab; this.parent = parent; this.size = size; } - public GameObject Get() { + public GemView Get() { return this.pool.Count == 0 ? Object.Instantiate(this.prefab, this.parent) : this.pool.Pop(); } @@ -27,7 +28,7 @@ namespace Services { } } - public void Release(GameObject gameObject) { + public void Release(GemView gameObject) { this.pool.Push(gameObject); } diff --git a/Assets/Scripts/Services/ScoreService.cs b/Assets/Scripts/Services/ScoreService.cs new file mode 100644 index 0000000..09af96a --- /dev/null +++ b/Assets/Scripts/Services/ScoreService.cs @@ -0,0 +1,11 @@ +using System; +using Services.Interfaces; + +namespace Services { + public class ScoreService : IScoreService { + private int score = 0; + public void ScoreCheck(int value) { + this.score += value; + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Services/ScoreService.cs.meta b/Assets/Scripts/Services/ScoreService.cs.meta new file mode 100644 index 0000000..0b0ca6d --- /dev/null +++ b/Assets/Scripts/Services/ScoreService.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b5bac284955046708f571939e29d9dff +timeCreated: 1765674722 \ No newline at end of file diff --git a/Assets/Scripts/Mono.meta b/Assets/Scripts/Views.meta similarity index 100% rename from Assets/Scripts/Mono.meta rename to Assets/Scripts/Views.meta diff --git a/Assets/Scripts/Views/GemView.cs b/Assets/Scripts/Views/GemView.cs new file mode 100644 index 0000000..e48d738 --- /dev/null +++ b/Assets/Scripts/Views/GemView.cs @@ -0,0 +1,16 @@ +using Enums; +using Services; +using UnityEngine; + +namespace Views { + public class GemView : MonoBehaviour { + private Gem gem; + public Gem Gem => this.gem; + + public void UpdatePosition(Vector2Int positionBasedOnIndex) { + if (Vector2.Distance(this.transform.position, positionBasedOnIndex) > 0.01f) { + this.transform.position = Vector2.Lerp(this.transform.position, positionBasedOnIndex, 0.1f); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/Views/GemView.cs.meta b/Assets/Scripts/Views/GemView.cs.meta new file mode 100644 index 0000000..e2701a3 --- /dev/null +++ b/Assets/Scripts/Views/GemView.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 7645dd1d371740729311dd834ab649f3 +timeCreated: 1765659213 \ No newline at end of file diff --git a/Assets/VContainerSettings.asset b/Assets/VContainerSettings.asset new file mode 100644 index 0000000..5fdbcff --- /dev/null +++ b/Assets/VContainerSettings.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9cf4d8df1d704d5689f3c69bd70d1cb9, type: 3} + m_Name: VContainerSettings + m_EditorClassIdentifier: + RootLifetimeScope: {fileID: 7273189601935488900, guid: 520a563433527df408515da372ea797f, + type: 3} + EnableDiagnostics: 0 + DisableScriptModifier: 0 + RemoveClonePostfix: 0 diff --git a/Assets/VContainerSettings.asset.meta b/Assets/VContainerSettings.asset.meta new file mode 100644 index 0000000..56d83d0 --- /dev/null +++ b/Assets/VContainerSettings.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f9315cf9da5a9c4c8cf80f5db8e6584 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index cd78041..2a68e8a 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,5 +1,6 @@ { "dependencies": { + "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask", "com.unity.ai.navigation": "1.1.6", "com.unity.collab-proxy": "2.10.2", "com.unity.feature.2d": "2.0.1", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index f524a41..197460c 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -1,5 +1,12 @@ { "dependencies": { + "com.cysharp.unitask": { + "version": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask", + "depth": 0, + "source": "git", + "dependencies": {}, + "hash": "73a63b7f672b88f7e9992f6917eb458a8cbb6fa9" + }, "com.unity.2d.animation": { "version": "9.2.0", "depth": 1, diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 9083cb2..b8731db 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -142,7 +142,8 @@ PlayerSettings: visionOSBundleVersion: 1.0 tvOSBundleVersion: 1.0 bundleVersion: 0.1 - preloadedAssets: [] + preloadedAssets: + - {fileID: 11400000, guid: 3f9315cf9da5a9c4c8cf80f5db8e6584, type: 2} metroInputSource: 0 wsaTransparentSwapchain: 0 m_HolographicPauseOnTrackingLoss: 1 diff --git a/ProjectSettings/SceneTemplateSettings.json b/ProjectSettings/SceneTemplateSettings.json new file mode 100644 index 0000000..5e97f83 --- /dev/null +++ b/ProjectSettings/SceneTemplateSettings.json @@ -0,0 +1,121 @@ +{ + "templatePinStates": [], + "dependencyTypeInfos": [ + { + "userAdded": false, + "type": "UnityEngine.AnimationClip", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEditor.Animations.AnimatorController", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.AnimatorOverrideController", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEditor.Audio.AudioMixerController", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.ComputeShader", + "defaultInstantiationMode": 1 + }, + { + "userAdded": false, + "type": "UnityEngine.Cubemap", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.GameObject", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEditor.LightingDataAsset", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.LightingSettings", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.Material", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEditor.MonoScript", + "defaultInstantiationMode": 1 + }, + { + "userAdded": false, + "type": "UnityEngine.PhysicMaterial", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.PhysicsMaterial2D", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.VolumeProfile", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEditor.SceneAsset", + "defaultInstantiationMode": 1 + }, + { + "userAdded": false, + "type": "UnityEngine.Shader", + "defaultInstantiationMode": 1 + }, + { + "userAdded": false, + "type": "UnityEngine.ShaderVariantCollection", + "defaultInstantiationMode": 1 + }, + { + "userAdded": false, + "type": "UnityEngine.Texture", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.Texture2D", + "defaultInstantiationMode": 0 + }, + { + "userAdded": false, + "type": "UnityEngine.Timeline.TimelineAsset", + "defaultInstantiationMode": 0 + } + ], + "defaultDependencyTypeInfo": { + "userAdded": false, + "type": "", + "defaultInstantiationMode": 1 + }, + "newSceneOverride": 0 +} \ No newline at end of file