From cee49a0a7a6f8ec156bf529ddf708f98bce358ab Mon Sep 17 00:00:00 2001 From: Lorenzo Balugani Date: Mon, 13 Aug 2018 14:12:46 +0200 Subject: [PATCH 1/2] Add ending screen + score transfer Add ending screen + score transfer --- Assets/Scenes/Results.unity | 192 +++++++++++++++++++++++++++++++ Assets/Scenes/Results.unity.meta | 7 ++ Assets/Scripts/Countdown.cs | 8 +- Assets/Scripts/Countdown.cs.meta | 3 +- 4 files changed, 207 insertions(+), 3 deletions(-) create mode 100644 Assets/Scenes/Results.unity create mode 100644 Assets/Scenes/Results.unity.meta diff --git a/Assets/Scenes/Results.unity b/Assets/Scenes/Results.unity new file mode 100644 index 0000000..381640b --- /dev/null +++ b/Assets/Scenes/Results.unity @@ -0,0 +1,192 @@ +%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_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 11 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 10 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 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: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringMode: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ShowResolutionOverlay: 1 + m_LightingDataAsset: {fileID: 0} + m_UseShadowmask: 1 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + 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 + accuratePlacement: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &441426336 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 441426339} + - component: {fileID: 441426338} + - component: {fileID: 441426337} + 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 &441426337 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 441426336} + m_Enabled: 1 +--- !u!20 &441426338 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 441426336} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + 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: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &441426339 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 441426336} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scenes/Results.unity.meta b/Assets/Scenes/Results.unity.meta new file mode 100644 index 0000000..c9bf470 --- /dev/null +++ b/Assets/Scenes/Results.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 14eaa48c4049adc49a31ec5ab5921898 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Countdown.cs b/Assets/Scripts/Countdown.cs index 3eaac72..7998152 100644 --- a/Assets/Scripts/Countdown.cs +++ b/Assets/Scripts/Countdown.cs @@ -6,7 +6,7 @@ using UnityEngine.UI; public class Countdown : MonoBehaviour { public float startingTime = 500f; - + public GameObject script; private float currentTime = 500f; private Text timerText; @@ -26,6 +26,10 @@ public class Countdown : MonoBehaviour { void TheEnd() { - //Do something + FishCatcher presi; + presi = script.GetComponent(); + int score = presi.fishCaught; + Debug.Log(score); + PlayerPrefs.SetInt("player_score", score); } } diff --git a/Assets/Scripts/Countdown.cs.meta b/Assets/Scripts/Countdown.cs.meta index ffb304e..2aa1ae1 100644 --- a/Assets/Scripts/Countdown.cs.meta +++ b/Assets/Scripts/Countdown.cs.meta @@ -3,7 +3,8 @@ guid: 80f6e912b74c1744d83aedb0e365fa93 MonoImporter: externalObjects: {} serializedVersion: 2 - defaultReferences: [] + defaultReferences: + - script: {instanceID: 0} executionOrder: 0 icon: {instanceID: 0} userData: From 76a049f5795afa8b85d445825a57f3bf6114fbe8 Mon Sep 17 00:00:00 2001 From: Lorenzo Balugani Date: Mon, 13 Aug 2018 14:58:19 +0200 Subject: [PATCH 2/2] Add fish counter + Ending screen now works --- Assets/Scenes/Game.unity | 19 +- Assets/Scenes/Results.unity | 725 +++++++++++++++++++++-- Assets/Scripts/Countdown.cs | 2 + Assets/Scripts/FishSpawnerEnding.cs | 37 ++ Assets/Scripts/FishSpawnerEnding.cs.meta | 11 + 5 files changed, 743 insertions(+), 51 deletions(-) create mode 100644 Assets/Scripts/FishSpawnerEnding.cs create mode 100644 Assets/Scripts/FishSpawnerEnding.cs.meta diff --git a/Assets/Scenes/Game.unity b/Assets/Scenes/Game.unity index 8bbc9d5..35dd12c 100644 --- a/Assets/Scenes/Game.unity +++ b/Assets/Scenes/Game.unity @@ -217,6 +217,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: startingTime: 240 + script: {fileID: 1410052124} --- !u!114 &189120858 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1515,15 +1516,15 @@ Prefab: objectReference: {fileID: 0} - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} propertyPath: m_LocalRotation.w @@ -1533,6 +1534,18 @@ Prefab: propertyPath: m_RootOrder value: 1 objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalScale.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalScale.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4279439219186522, guid: 1cf703958a669d942a42326499701367, type: 2} + propertyPath: m_LocalScale.z + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 1cf703958a669d942a42326499701367, type: 2} m_IsPrefabAsset: 0 diff --git a/Assets/Scenes/Results.unity b/Assets/Scenes/Results.unity index 381640b..1aec93d 100644 --- a/Assets/Scenes/Results.unity +++ b/Assets/Scenes/Results.unity @@ -113,80 +113,709 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} ---- !u!1 &441426336 +--- !u!1 &314826819 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 441426339} - - component: {fileID: 441426338} - - component: {fileID: 441426337} + - component: {fileID: 314826822} + - component: {fileID: 314826821} + - component: {fileID: 314826820} m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera + m_Name: EventSystem + m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!81 &441426337 -AudioListener: +--- !u!114 &314826820 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 441426336} + m_GameObject: {fileID: 314826819} m_Enabled: 1 ---- !u!20 &441426338 -Camera: + m_EditorHideFlags: 0 + m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &314826821 +MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 441426336} + m_GameObject: {fileID: 314826819} m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_FocalLength: 50 - 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: 5 - m_Depth: -1 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!4 &441426339 + m_EditorHideFlags: 0 + m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &314826822 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 441426336} + m_GameObject: {fileID: 314826819} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &339374824 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4769752010558754, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} + propertyPath: m_LocalPosition.x + value: -0.5936575 + objectReference: {fileID: 0} + - target: {fileID: 4769752010558754, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} + propertyPath: m_LocalPosition.y + value: -14.76 + objectReference: {fileID: 0} + - target: {fileID: 4769752010558754, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4769752010558754, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4769752010558754, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4769752010558754, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4769752010558754, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4769752010558754, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 114441698435220922, guid: 4dc0408b236da9847b1c799161bbd70a, + type: 2} + propertyPath: speed + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 4dc0408b236da9847b1c799161bbd70a, type: 2} + m_IsPrefabAsset: 0 +--- !u!1 &404389873 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 404389875} + - component: {fileID: 404389874} + m_Layer: 0 + m_Name: GameObject (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!61 &404389874 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 404389873} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.22894168, y: 10.276661} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1.4579835, y: 59.96476} + m_EdgeRadius: 0 +--- !u!4 &404389875 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 404389873} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -50.5, y: 14.9, z: 0.1662893} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &594676545 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 594676547} + - component: {fileID: 594676546} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!61 &594676546 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 594676545} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.22894168, y: 10.276661} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 1.4579835, y: 59.96476} + m_EdgeRadius: 0 +--- !u!4 &594676547 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 594676545} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 50.99, y: 14.9, z: 0.1662893} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &824294108 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 824294109} + - component: {fileID: 824294111} + - component: {fileID: 824294110} + m_Layer: 5 + m_Name: urScore + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &824294109 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 824294108} + 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_Children: [] + m_Father: {fileID: 2050323200} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 473, y: 286} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &824294110 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 824294108} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 14 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 10 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: Your score is +--- !u!222 &824294111 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 824294108} + m_CullTransparentMesh: 0 +--- !u!1 &924959373 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1353125949220882, guid: 4dc0408b236da9847b1c799161bbd70a, + type: 2} + m_PrefabInternal: {fileID: 339374824} +--- !u!1001 &955778280 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2} + propertyPath: m_LocalPosition.x + value: -0.01 + objectReference: {fileID: 0} + - target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2} + propertyPath: m_LocalPosition.y + value: 20.2 + objectReference: {fileID: 0} + - target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2} + propertyPath: m_LocalPosition.z + value: -1 + objectReference: {fileID: 0} + - target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4059627635461364, guid: acb6270a21e7fa744878210a4df90d27, type: 2} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 114070643257783382, guid: acb6270a21e7fa744878210a4df90d27, + type: 2} + propertyPath: target + value: + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: acb6270a21e7fa744878210a4df90d27, type: 2} + m_IsPrefabAsset: 0 +--- !u!1 &1002943997 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1634593922401586, guid: 343a89599f7365845937eb14b4669b20, + type: 2} + m_PrefabInternal: {fileID: 1829515768} +--- !u!114 &1002943998 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1002943997} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: af2cb05ef3ea8ef4db59180b58866340, type: 3} + m_Name: + m_EditorClassIdentifier: + spawnTime: 1 + randomFactor: 0 + fish: {fileID: 1615301965237016, guid: 3b07c51a898a8e342b3d0236ca47bf8c, type: 2} + sea: {fileID: 1883986867} + punteggio: {fileID: 1625724831} +--- !u!1 &1497958429 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1497958431} + - component: {fileID: 1497958430} + m_Layer: 0 + m_Name: GameObject (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!61 &1497958430 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1497958429} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -50.322166, y: 38.927853} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 101.644424, y: 2.6623764} + m_EdgeRadius: 0 +--- !u!4 &1497958431 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1497958429} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 50.99, y: 14.9, z: 0.1662893} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1625724829 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1625724830} + - component: {fileID: 1625724832} + - component: {fileID: 1625724831} + m_Layer: 5 + m_Name: score + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1625724830 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1625724829} + 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_Children: [] + m_Father: {fileID: 2050323200} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 543.2, y: 240} + m_SizeDelta: {x: 160, y: 30} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1625724831 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1625724829} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 20 + m_FontStyle: 0 + m_BestFit: 1 + m_MinSize: 2 + m_MaxSize: 40 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 0 +--- !u!222 &1625724832 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1625724829} + m_CullTransparentMesh: 0 +--- !u!1 &1761400630 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1761400632} + - component: {fileID: 1761400631} + m_Layer: 0 + m_Name: GameObject (3) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!61 &1761400631 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1761400630} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -50.322166, y: 38.927853} + m_SpriteTilingProperty: + border: {x: 0, y: 0, z: 0, w: 0} + pivot: {x: 0, y: 0} + oldSize: {x: 0, y: 0} + newSize: {x: 0, y: 0} + adaptiveTilingThreshold: 0 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 101.644424, y: 2.6623764} + m_EdgeRadius: 0 +--- !u!4 &1761400632 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1761400630} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 50.99, y: -40.7, z: 0.1662893} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1001 &1829515768 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2} + propertyPath: m_LocalPosition.x + value: -0.08 + objectReference: {fileID: 0} + - target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2} + propertyPath: m_LocalPosition.y + value: 18.1 + objectReference: {fileID: 0} + - target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4955254497044876, guid: 343a89599f7365845937eb14b4669b20, type: 2} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20, + type: 2} + propertyPath: sea + value: + objectReference: {fileID: 924959373} + - target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20, + type: 2} + propertyPath: spawnTime + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20, + type: 2} + propertyPath: randomFactor + value: 1 + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 114324088513504716, guid: 343a89599f7365845937eb14b4669b20, type: 2} + m_SourcePrefab: {fileID: 100100000, guid: 343a89599f7365845937eb14b4669b20, type: 2} + m_IsPrefabAsset: 0 +--- !u!1 &1883986867 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 1259758189242624, guid: 4dc0408b236da9847b1c799161bbd70a, + type: 2} + m_PrefabInternal: {fileID: 339374824} +--- !u!1 &2050323196 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2050323200} + - component: {fileID: 2050323199} + - component: {fileID: 2050323198} + - component: {fileID: 2050323197} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &2050323197 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2050323196} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &2050323198 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2050323196} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!223 &2050323199 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2050323196} + 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_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &2050323200 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 2050323196} + 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_Children: + - {fileID: 824294109} + - {fileID: 1625724830} + m_Father: {fileID: 0} + m_RootOrder: 7 + 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} diff --git a/Assets/Scripts/Countdown.cs b/Assets/Scripts/Countdown.cs index 7998152..7b94320 100644 --- a/Assets/Scripts/Countdown.cs +++ b/Assets/Scripts/Countdown.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; +using UnityEngine.SceneManagement; public class Countdown : MonoBehaviour { @@ -31,5 +32,6 @@ public class Countdown : MonoBehaviour { int score = presi.fishCaught; Debug.Log(score); PlayerPrefs.SetInt("player_score", score); + SceneManager.LoadSceneAsync("Results", LoadSceneMode.Single); } } diff --git a/Assets/Scripts/FishSpawnerEnding.cs b/Assets/Scripts/FishSpawnerEnding.cs new file mode 100644 index 0000000..9113281 --- /dev/null +++ b/Assets/Scripts/FishSpawnerEnding.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class FishSpawnerEnding : MonoBehaviour +{ + + public float spawnTime = 5f; + public float randomFactor = 1f; + public GameObject fish; + public GameObject sea; + public Text punteggio; + private float timeToSpawn; + private int toSpawn; + private int spawned = 0; + + void Start() + { + timeToSpawn = Random.Range(spawnTime - randomFactor, spawnTime + randomFactor); + toSpawn = PlayerPrefs.GetInt("player_score"); + } + + void Update() + { + timeToSpawn -= Time.deltaTime; + if (timeToSpawn <= 0 && spawned < toSpawn) + { + GameObject newFish = Instantiate(fish); + newFish.transform.position = transform.position; + newFish.GetComponent().sea = sea; + timeToSpawn = Random.Range(spawnTime - randomFactor, spawnTime + randomFactor); + spawned++; + punteggio.text = spawned.ToString(); + } + } +} diff --git a/Assets/Scripts/FishSpawnerEnding.cs.meta b/Assets/Scripts/FishSpawnerEnding.cs.meta new file mode 100644 index 0000000..bed5977 --- /dev/null +++ b/Assets/Scripts/FishSpawnerEnding.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: af2cb05ef3ea8ef4db59180b58866340 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: