diff --git a/Assets/Prefabs/wall.prefab b/Assets/Prefabs/wall.prefab new file mode 100644 index 0000000..cb02900 --- /dev/null +++ b/Assets/Prefabs/wall.prefab @@ -0,0 +1,160 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &5565515144999881690 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8865155771655828675} + - component: {fileID: 4678140147064048881} + - component: {fileID: 5375054258917808226} + - component: {fileID: 7479966982656622299} + m_Layer: 0 + m_Name: wall + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 2147483647 + m_IsActive: 1 +--- !u!4 &8865155771655828675 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5565515144999881690} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -12.169596, y: 1.9556671, z: 8.178603} + m_LocalScale: {x: 1, y: 70, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &4678140147064048881 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5565515144999881690} + 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: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 10911, guid: 0000000000000000f000000000000000, type: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.16, y: 0.16} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!50 &5375054258917808226 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5565515144999881690} + m_BodyType: 1 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: 0.05 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!61 &7479966982656622299 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5565515144999881690} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IncludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_ExcludeLayers: + serializedVersion: 2 + m_Bits: 0 + m_LayerOverridePriority: 0 + m_ForceSendLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ForceReceiveLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_ContactCaptureLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_CallbackLayers: + serializedVersion: 2 + m_Bits: 4294967295 + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: -0.00000035762787, y: 0} + m_SpriteTilingProperty: + border: {x: 0.049999997, y: 0.049999997, z: 0.049999997, w: 0.049999997} + pivot: {x: 0.5, y: 0.5} + oldSize: {x: 0.16, y: 0.16} + newSize: {x: 0.16, y: 0.16} + adaptiveTilingThreshold: 0.5 + drawMode: 0 + adaptiveTiling: 0 + m_AutoTiling: 0 + serializedVersion: 2 + m_Size: {x: 0.24104118, y: 0.16} + m_EdgeRadius: 0 diff --git a/Assets/Prefabs/wall.prefab.meta b/Assets/Prefabs/wall.prefab.meta new file mode 100644 index 0000000..f4955c4 --- /dev/null +++ b/Assets/Prefabs/wall.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: b76cacbcd70327f469bec9156113cb9b +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/2-prefabs/d-shooter.unity b/Assets/Scenes/2-prefabs/d-shooter.unity index 053d4a2..90d5d8b 100644 --- a/Assets/Scenes/2-prefabs/d-shooter.unity +++ b/Assets/Scenes/2-prefabs/d-shooter.unity @@ -104,7 +104,7 @@ NavMeshSettings: serializedVersion: 2 m_ObjectHideFlags: 0 m_BuildSettings: - serializedVersion: 2 + serializedVersion: 3 agentTypeID: 0 agentRadius: 0.5 agentHeight: 2 @@ -117,7 +117,7 @@ NavMeshSettings: cellSize: 0.16666667 manualTileSize: 0 tileSize: 256 - accuratePlacement: 0 + buildHeightMesh: 0 maxJobWorkers: 0 preserveTilesOutsideBounds: 0 debug: @@ -280,13 +280,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 97342529} + serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0.9199297, w: 0.3920835} m_LocalPosition: {x: -0.06556451, y: -3.398108, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: -133.832} --- !u!114 &97342533 MonoBehaviour: @@ -320,6 +320,7 @@ MonoBehaviour: prefabToSpawn: {fileID: 206225842732292031, guid: 7526879c03876874881ee2da051c9345, type: 3} velocityOfSpawnedObject: {x: 0, y: 20, z: 0} + secondsBetweenShoot: 0.5 --- !u!1 &187464074 GameObject: m_ObjectHideFlags: 0 @@ -343,6 +344,7 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 187464074} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 2.309596, y: -1.9156672, z: -8.178603} m_LocalScale: {x: 1, y: 1, z: 1} @@ -352,13 +354,13 @@ Transform: - {fileID: 750246238} - {fileID: 399964565} m_Father: {fileID: 0} - m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &263763083 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 187464075} m_Modifications: - target: {fileID: 8392271928695271261, guid: 76dd5d4eb2061104b9a72b003c24ce25, @@ -432,6 +434,9 @@ PrefabInstance: value: 0.5 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 76dd5d4eb2061104b9a72b003c24ce25, type: 3} --- !u!4 &263763084 stripped Transform: @@ -446,7 +451,7 @@ LightingSettings: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_Name: Settings.lighting - serializedVersion: 4 + serializedVersion: 6 m_GIWorkflowMode: 1 m_EnableBakedLightmaps: 0 m_EnableRealtimeLightmaps: 0 @@ -486,7 +491,7 @@ LightingSettings: m_LightProbeSampleCountMultiplier: 4 m_PVRBounces: 2 m_PVRMinBounces: 2 - m_PVREnvironmentMIS: 1 + m_PVREnvironmentImportanceSampling: 1 m_PVRFilteringMode: 1 m_PVRDenoiserTypeDirect: 1 m_PVRDenoiserTypeIndirect: 1 @@ -501,11 +506,14 @@ LightingSettings: m_PVRFilteringAtrousPositionSigmaIndirect: 2 m_PVRFilteringAtrousPositionSigmaAO: 1 m_PVRTiledBaking: 0 + m_NumRaysToShootPerTexel: -1 + m_RespectSceneVisibilityWhenBakingGI: 0 --- !u!1001 &399964564 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 187464075} m_Modifications: - target: {fileID: 8392271928695271261, guid: 76dd5d4eb2061104b9a72b003c24ce25, @@ -584,6 +592,9 @@ PrefabInstance: value: -4 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 76dd5d4eb2061104b9a72b003c24ce25, type: 3} --- !u!4 &399964565 stripped Transform: @@ -677,13 +688,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 552903276} + serializedVersion: 2 m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} m_LocalPosition: {x: -7.55, y: 3.48, z: 10.49} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} --- !u!4 &750246238 stripped Transform: @@ -767,13 +778,13 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 945324278} + serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0.115, y: -0.05, z: 1} m_LocalScale: {x: 1.9126194, y: 1.4714665, z: 0.9528718} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &2070287829 GameObject: @@ -815,9 +826,17 @@ Camera: 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_FocalLength: 50 m_NormalizedViewPortRect: serializedVersion: 2 x: 0 @@ -851,19 +870,20 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2070287829} + serializedVersion: 2 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &8392271928369018371 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: + serializedVersion: 3 m_TransformParent: {fileID: 187464075} m_Modifications: - target: {fileID: 8392271928695271261, guid: 76dd5d4eb2061104b9a72b003c24ce25, @@ -932,4 +952,16 @@ PrefabInstance: value: -3 objectReference: {fileID: 0} m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 76dd5d4eb2061104b9a72b003c24ce25, type: 3} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 2070287832} + - {fileID: 552903278} + - {fileID: 945324280} + - {fileID: 97342532} + - {fileID: 187464075} diff --git a/Assets/Scenes/4-levels/level-1.unity b/Assets/Scenes/4-levels/level-1.unity index 440250e..6ea59a8 100644 --- a/Assets/Scenes/4-levels/level-1.unity +++ b/Assets/Scenes/4-levels/level-1.unity @@ -124,6 +124,119 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1001 &38470353 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 187464075} + m_Modifications: + - target: {fileID: 4678140147064048881, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_SortingOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5375054258917808226, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_BodyType + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 5375054258917808226, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_Simulated + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5375054258917808226, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_CollisionDetection + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5375054258917808226, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_UseFullKinematicContacts + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5565515144999881690, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_Name + value: wall (1) + objectReference: {fileID: 0} + - target: {fileID: 5565515144999881690, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_TagString + value: Wall + objectReference: {fileID: 0} + - target: {fileID: 5565515144999881690, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} + - target: {fileID: 7479966982656622299, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7479966982656622299, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_IsTrigger + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalPosition.x + value: 7.6 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalPosition.y + value: 1.9556671 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalPosition.z + value: 8.178603 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: b76cacbcd70327f469bec9156113cb9b, type: 3} --- !u!1 &187464074 GameObject: m_ObjectHideFlags: 0 @@ -153,6 +266,8 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 484704405} + - {fileID: 1671282316} - {fileID: 263763084} - {fileID: 750246238} - {fileID: 399964565} @@ -226,6 +341,11 @@ PrefabInstance: propertyPath: m_Name value: LeftSpawner objectReference: {fileID: 0} + - target: {fileID: 8392271928695271262, guid: 76dd5d4eb2061104b9a72b003c24ce25, + type: 3} + propertyPath: m_TagString + value: Enemy + objectReference: {fileID: 0} - target: {fileID: 8392271928695271266, guid: 76dd5d4eb2061104b9a72b003c24ce25, type: 3} propertyPath: prefabToSpawn @@ -321,6 +441,11 @@ PrefabInstance: propertyPath: m_Name value: RightSpawner objectReference: {fileID: 0} + - target: {fileID: 8392271928695271262, guid: 76dd5d4eb2061104b9a72b003c24ce25, + type: 3} + propertyPath: m_TagString + value: Enemy + objectReference: {fileID: 0} - target: {fileID: 8392271928695271266, guid: 76dd5d4eb2061104b9a72b003c24ce25, type: 3} propertyPath: prefabToSpawn @@ -353,6 +478,12 @@ Transform: type: 3} m_PrefabInstance: {fileID: 399964564} m_PrefabAsset: {fileID: 0} +--- !u!4 &484704405 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + m_PrefabInstance: {fileID: 6871282525149577064} + m_PrefabAsset: {fileID: 0} --- !u!1 &552903276 GameObject: m_ObjectHideFlags: 0 @@ -531,8 +662,8 @@ Transform: m_GameObject: {fileID: 945324278} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0.115, y: -0.05, z: 1} - m_LocalScale: {x: 1.9126194, y: 1.4714665, z: 0.9528718} + m_LocalPosition: {x: 0.0449, y: -0.0573, z: 1} + m_LocalScale: {x: 1.9851556, y: 1.1658068, z: 0.9528718} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} @@ -618,7 +749,7 @@ Transform: m_GameObject: {fileID: 1144032734} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 6.98, y: 3.85, z: 0} + m_LocalPosition: {x: 7.01, y: 2.76, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -707,6 +838,12 @@ MonoBehaviour: m_EditorClassIdentifier: sceneName: level-2 scoreField: {fileID: 1811610590} +--- !u!4 &1671282316 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + m_PrefabInstance: {fileID: 38470353} + m_PrefabAsset: {fileID: 0} --- !u!1 &1811610584 GameObject: m_ObjectHideFlags: 0 @@ -1027,11 +1164,11 @@ Camera: y: 0 width: 1 height: 1 - near clip plane: 0.3 + near clip plane: 0.5 far clip plane: 1000 field of view: 60 orthographic: 1 - orthographic size: 5 + orthographic size: 4.2825775 m_Depth: -1 m_CullingMask: serializedVersion: 2 @@ -1057,7 +1194,7 @@ Transform: serializedVersion: 2 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_LocalScale: {x: 2.1795218, y: 3.596211, z: 2.1795218} m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} @@ -1079,6 +1216,7 @@ GameObject: - component: {fileID: 1363711266115913} - component: {fileID: 1363711266115910} - component: {fileID: 1363711266115911} + - component: {fileID: 212522841112678494} m_Layer: 0 m_Name: PlayerSpaceship m_TagString: Player @@ -1115,7 +1253,7 @@ CapsuleCollider2D: m_CallbackLayers: serializedVersion: 2 m_Bits: 4294967295 - m_IsTrigger: 1 + m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 m_Offset: {x: -0.103332736, y: 0.02921189} @@ -1155,12 +1293,13 @@ MonoBehaviour: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1363711266115907} - m_Enabled: 0 + m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 7b571bdbf83e603449e50749327e251f, type: 3} m_Name: m_EditorClassIdentifier: triggeringTag: Enemy + vanishOnTag: Wall --- !u!114 &1363711266115911 MonoBehaviour: m_ObjectHideFlags: 0 @@ -1193,6 +1332,7 @@ MonoBehaviour: prefabToSpawn: {fileID: 206225842732292031, guid: 1064f1e6fd4430a48ae8a63513c527b4, type: 3} velocityOfSpawnedObject: {x: 0, y: 10, z: 0} + secondsBetweenShoot: 0.7 scoreField: {fileID: 1811610590} --- !u!114 &1363711266115913 MonoBehaviour: @@ -1216,8 +1356,8 @@ Transform: m_GameObject: {fileID: 1363711266115907} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: -0.7071068, w: 0.7071068} - m_LocalPosition: {x: 0.11, y: -3.24, z: 0} - m_LocalScale: {x: 0.648, y: 0.573, z: 1} + m_LocalPosition: {x: -0.288, y: -2.9844, z: 0} + m_LocalScale: {x: 0.46741885, y: 0.44400468, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1811610585} @@ -1296,6 +1436,131 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 +--- !u!114 &212522841112678494 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1363711266115907} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3460ad62ce8a39e47a75c13b362f00d7, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1001 &6871282525149577064 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 187464075} + m_Modifications: + - target: {fileID: 4678140147064048881, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_SortingOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5375054258917808226, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_BodyType + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 5375054258917808226, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_Simulated + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5375054258917808226, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_CollisionDetection + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5375054258917808226, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_UseFullKinematicContacts + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5565515144999881690, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_Name + value: wall + objectReference: {fileID: 0} + - target: {fileID: 5565515144999881690, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_TagString + value: Wall + objectReference: {fileID: 0} + - target: {fileID: 5565515144999881690, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_StaticEditorFlags + value: 2147483647 + objectReference: {fileID: 0} + - target: {fileID: 7479966982656622299, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7479966982656622299, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_IsTrigger + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalPosition.x + value: -12.169596 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalPosition.y + value: 1.9556671 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalPosition.z + value: 8.178603 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalRotation.x + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalRotation.y + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalRotation.z + value: -0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8865155771655828675, guid: b76cacbcd70327f469bec9156113cb9b, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: b76cacbcd70327f469bec9156113cb9b, type: 3} --- !u!1001 &8392271928369018371 PrefabInstance: m_ObjectHideFlags: 0 @@ -1364,6 +1629,11 @@ PrefabInstance: propertyPath: m_Name value: MiddleSpawner objectReference: {fileID: 0} + - target: {fileID: 8392271928695271262, guid: 76dd5d4eb2061104b9a72b003c24ce25, + type: 3} + propertyPath: m_TagString + value: Enemy + objectReference: {fileID: 0} - target: {fileID: 8392271928695271266, guid: 76dd5d4eb2061104b9a72b003c24ce25, type: 3} propertyPath: prefabToSpawn diff --git a/Assets/Scripts/2-spawners/ClickSpawner.cs b/Assets/Scripts/2-spawners/ClickSpawner.cs index 0121338..0f70b75 100644 --- a/Assets/Scripts/2-spawners/ClickSpawner.cs +++ b/Assets/Scripts/2-spawners/ClickSpawner.cs @@ -11,6 +11,11 @@ public class ClickSpawner: MonoBehaviour { [SerializeField] protected InputAction spawnAction = new InputAction(type: InputActionType.Button); [SerializeField] protected GameObject prefabToSpawn; [SerializeField] protected Vector3 velocityOfSpawnedObject; + [SerializeField] float secondsBetweenShoot; + + + + private bool isWaiting = false; void OnEnable() { spawnAction.Enable(); @@ -19,27 +24,44 @@ void OnEnable() { void OnDisable() { spawnAction.Disable(); } + IEnumerator Wait() + { + isWaiting = true; + yield return new WaitForSeconds(secondsBetweenShoot); // Wait for 1 second + isWaiting = false; + } - protected virtual GameObject spawnObject() { - Debug.Log("Spawning a new object"); + protected virtual GameObject spawnObject() + { - // Step 1: spawn the new object. - Vector3 positionOfSpawnedObject = transform.position; // span at the containing object position. - Quaternion rotationOfSpawnedObject = Quaternion.identity; // no rotation. - GameObject newObject = Instantiate(prefabToSpawn, positionOfSpawnedObject, rotationOfSpawnedObject); + if (!isWaiting) + { + Debug.Log("Spawning a new object"); - // Step 2: modify the velocity of the new object. - Mover newObjectMover = newObject.GetComponent(); - if (newObjectMover) { - newObjectMover.SetVelocity(velocityOfSpawnedObject); - } + // Step 1: spawn the new object. + Vector3 positionOfSpawnedObject = transform.position; // span at the containing object position. + Quaternion rotationOfSpawnedObject = Quaternion.identity; // no rotation. + GameObject newObject = Instantiate(prefabToSpawn, positionOfSpawnedObject, rotationOfSpawnedObject); - return newObject; + // Step 2: modify the velocity of the new object. + Mover newObjectMover = newObject.GetComponent(); + if (newObjectMover) + { + newObjectMover.SetVelocity(velocityOfSpawnedObject); + } + StartCoroutine(Wait()); + + return newObject; + } + return null; } - + + private void Update() { if (spawnAction.WasPressedThisFrame()) { spawnObject(); } + + } } diff --git a/Assets/Scripts/2-spawners/LaserShooter.cs b/Assets/Scripts/2-spawners/LaserShooter.cs index ca96566..8e44543 100644 --- a/Assets/Scripts/2-spawners/LaserShooter.cs +++ b/Assets/Scripts/2-spawners/LaserShooter.cs @@ -1,4 +1,6 @@ -using UnityEngine; +using System; +using System.Collections; +using UnityEngine; /** * This component spawns the given laser-prefab whenever the player clicks a given key. @@ -7,14 +9,25 @@ public class LaserShooter: ClickSpawner { [SerializeField] NumberField scoreField; + + protected override GameObject spawnObject() { + + GameObject newObject = base.spawnObject(); // base = super // Modify the text field of the new object. - ScoreAdder newObjectScoreAdder = newObject.GetComponent(); - if (newObjectScoreAdder) - newObjectScoreAdder.SetScoreField(scoreField); + if(newObject != null ) + { + ScoreAdder newObjectScoreAdder = newObject.GetComponent(); + if (newObjectScoreAdder) + newObjectScoreAdder.SetScoreField(scoreField); - return newObject; + + return newObject; + } + return null; + } + } diff --git a/Assets/Scripts/3-collisions/DestroyOnTrigger2D.cs b/Assets/Scripts/3-collisions/DestroyOnTrigger2D.cs index 0d00fc1..7ae3a86 100644 --- a/Assets/Scripts/3-collisions/DestroyOnTrigger2D.cs +++ b/Assets/Scripts/3-collisions/DestroyOnTrigger2D.cs @@ -8,9 +8,17 @@ public class DestroyOnTrigger2D : MonoBehaviour { [Tooltip("Every object tagged with this tag will trigger the destruction of this object")] [SerializeField] string triggeringTag; + [SerializeField] string vanishOnTag; private void OnTriggerEnter2D(Collider2D other) { - if (other.tag == triggeringTag && enabled) { + + if (other.tag == vanishOnTag) + { + Destroy(this.gameObject); + } + + + else if (other.tag == triggeringTag && enabled) { Destroy(this.gameObject); Destroy(other.gameObject); } diff --git a/Assets/Scripts/GameOverOnTrigger2D.cs b/Assets/Scripts/GameOverOnTrigger2D.cs index 5b44ca0..2c0be4e 100644 --- a/Assets/Scripts/GameOverOnTrigger2D.cs +++ b/Assets/Scripts/GameOverOnTrigger2D.cs @@ -6,12 +6,14 @@ public class GameOverOnTrigger2D : MonoBehaviour { [Tooltip("Every object tagged with this tag will trigger game over")] [SerializeField] string triggeringTag; + //[SerializeField] string StrongtriggeringTag; private void OnTriggerEnter2D(Collider2D other) { + if (other.tag == triggeringTag && enabled) { - Debug.Log("Game over!"); - Application.Quit(); - // UnityEditor.EditorApplication.isPlaying = false; # Error on editor 2021.3 + Debug.Log("Game over!"); + Application.Quit(); + // UnityEditor.EditorApplication.isPlaying = false; # Error on editor 2021.3 } } diff --git a/Build.zip b/Build.zip new file mode 100644 index 0000000..8079f1b Binary files /dev/null and b/Build.zip differ diff --git a/LICENSE b/LICENSE index 8d0ca01..ac9df56 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 erelsgl-at-ariel-gamedev +Copyright (c) 2024 Hod Wyskin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal