diff --git a/Space Shooter/Assets/Prefabs/Asteroid.prefab b/Space Shooter/Assets/Prefabs/Asteroid.prefab index d55052d..3241a8b 100644 --- a/Space Shooter/Assets/Prefabs/Asteroid.prefab +++ b/Space Shooter/Assets/Prefabs/Asteroid.prefab @@ -150,3 +150,5 @@ MonoBehaviour: playerExplosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, type: 3} scoreValue: 10 + health: 1 + Player: {fileID: 0} diff --git a/Space Shooter/Assets/Prefabs/Astroid Medium.prefab b/Space Shooter/Assets/Prefabs/Astroid Medium.prefab index af22e46..6f0d6f3 100644 --- a/Space Shooter/Assets/Prefabs/Astroid Medium.prefab +++ b/Space Shooter/Assets/Prefabs/Astroid Medium.prefab @@ -150,3 +150,5 @@ MonoBehaviour: playerExplosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, type: 3} scoreValue: 30 + health: 2 + Player: {fileID: 0} diff --git a/Space Shooter/Assets/Prefabs/Astroid big.prefab b/Space Shooter/Assets/Prefabs/Astroid big.prefab index 8a7ffa6..9d2fb26 100644 --- a/Space Shooter/Assets/Prefabs/Astroid big.prefab +++ b/Space Shooter/Assets/Prefabs/Astroid big.prefab @@ -150,3 +150,5 @@ MonoBehaviour: playerExplosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, type: 3} scoreValue: 50 + health: 3 + Player: {fileID: 0} diff --git a/Space Shooter/Assets/Prefabs/EnemyPlane.prefab b/Space Shooter/Assets/Prefabs/EnemyPlane.prefab index c54ec08..7147838 100644 --- a/Space Shooter/Assets/Prefabs/EnemyPlane.prefab +++ b/Space Shooter/Assets/Prefabs/EnemyPlane.prefab @@ -165,11 +165,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9e22954f4d28c134a8c3947b377ebf89, type: 3} m_Name: m_EditorClassIdentifier: - explosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, - type: 3} + explosion: {fileID: 0} playerExplosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, type: 3} - scoreValue: 100 + scoreValue: 50 + health: 1 + Player: {fileID: 0} --- !u!114 &114722790963509320 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Space Shooter/Assets/Prefabs/Player.prefab b/Space Shooter/Assets/Prefabs/Player.prefab new file mode 100644 index 0000000..894950a --- /dev/null +++ b/Space Shooter/Assets/Prefabs/Player.prefab @@ -0,0 +1,290 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &414629805906031132 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 414629805906031104} + - component: {fileID: 414629805906031105} + - component: {fileID: 414629805906031107} + - component: {fileID: 414629805906031134} + - component: {fileID: 414629805906031135} + - component: {fileID: 414629805906031106} + - component: {fileID: 114043405770662276} + m_Layer: 0 + m_Name: Player + m_TagString: Player + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &414629805906031104 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 414629805906031132} + 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: + - {fileID: 414629807406309354} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &414629805906031105 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 414629805906031132} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + 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_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + 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: 21300000, guid: d7774e37717658542aa460a670d56026, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_FlipX: 0 + m_FlipY: 0 + m_DrawMode: 0 + m_Size: {x: 0.54, y: 0.62} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!114 &414629805906031107 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 414629805906031132} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ad7f4137b7a3a5f4ab8e0dbabfa58236, type: 3} + m_Name: + m_EditorClassIdentifier: + speed: 5 + boundary: + xMin: -4.868 + xMax: 4.868 + yMin: -0.34 + yMax: 4.9 + Shot: {fileID: 8856353955679083582, guid: 46035d7c8d57a37498081013c50b391f, type: 3} + ShotSpawn: {fileID: 414629807406309354} + fireRate: 0.25 +--- !u!50 &414629805906031134 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 414629805906031132} + m_BodyType: 0 + 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_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!70 &414629805906031135 +CapsuleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 414629805906031132} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: -0.0010465682} + m_Size: {x: 0.54, y: 0.62209314} + m_Direction: 0 +--- !u!82 &414629805906031106 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 414629805906031132} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 8300000, guid: 9bc8b66baf0a5694d9f6e6e72b11e0db, type: 3} + m_PlayOnAwake: 0 + m_Volume: 0.5 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 +--- !u!114 &114043405770662276 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 414629805906031132} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9e22954f4d28c134a8c3947b377ebf89, type: 3} + m_Name: + m_EditorClassIdentifier: + explosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, + type: 3} + playerExplosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, + type: 3} + scoreValue: 0 + health: 4 + Player: {fileID: 414629805906031132} +--- !u!1 &414629807406309355 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 414629807406309354} + m_Layer: 0 + m_Name: ShotSpawn + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &414629807406309354 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 414629807406309355} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0.35, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 414629805906031104} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Space Shooter/Assets/Prefabs/Player.prefab.meta b/Space Shooter/Assets/Prefabs/Player.prefab.meta new file mode 100644 index 0000000..00b1461 --- /dev/null +++ b/Space Shooter/Assets/Prefabs/Player.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ede5a6e595cfb3e4fb379acd7616b344 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Space Shooter/Assets/Prefabs/RocketLaunch (enemy).prefab b/Space Shooter/Assets/Prefabs/RocketLaunch (enemy).prefab index e5c3802..415fe10 100644 --- a/Space Shooter/Assets/Prefabs/RocketLaunch (enemy).prefab +++ b/Space Shooter/Assets/Prefabs/RocketLaunch (enemy).prefab @@ -96,11 +96,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 9e22954f4d28c134a8c3947b377ebf89, type: 3} m_Name: m_EditorClassIdentifier: - explosion: {fileID: 0} + explosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, + type: 3} playerExplosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, type: 3} scoreValue: 0 health: 0 + Player: {fileID: 0} --- !u!114 &114097449171881602 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Space Shooter/Assets/Scenes/Main.unity b/Space Shooter/Assets/Scenes/Main.unity index 5a9a7d4..d2df370 100644 --- a/Space Shooter/Assets/Scenes/Main.unity +++ b/Space Shooter/Assets/Scenes/Main.unity @@ -537,6 +537,7 @@ GameObject: m_Component: - component: {fileID: 590622963} - component: {fileID: 590622962} + - component: {fileID: 590622964} m_Layer: 0 m_Name: GameController m_TagString: GameController @@ -585,163 +586,21 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &597029165 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 597029169} - - component: {fileID: 597029168} - - component: {fileID: 597029170} - - component: {fileID: 597029167} - - component: {fileID: 597029166} - - component: {fileID: 597029171} - m_Layer: 0 - m_Name: Player - m_TagString: Player - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!70 &597029166 -CapsuleCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 597029165} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 0, y: -0.0010465682} - m_Size: {x: 0.54, y: 0.62209314} - m_Direction: 0 ---- !u!50 &597029167 -Rigidbody2D: - serializedVersion: 4 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 597029165} - m_BodyType: 0 - 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_Interpolate: 0 - m_SleepingMode: 1 - m_CollisionDetection: 0 - m_Constraints: 0 ---- !u!212 &597029168 -SpriteRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 597029165} - m_Enabled: 1 - m_CastShadows: 0 - m_ReceiveShadows: 0 - m_DynamicOccludee: 1 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - 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_PreserveUVs: 0 - m_IgnoreNormalsForChartDetection: 0 - m_ImportantGI: 0 - m_StitchLightmapSeams: 0 - 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: 21300000, guid: d7774e37717658542aa460a670d56026, type: 3} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_FlipX: 0 - m_FlipY: 0 - m_DrawMode: 0 - m_Size: {x: 0.54, y: 0.62} - m_AdaptiveModeThreshold: 0.5 - m_SpriteTileMode: 0 - m_WasSpriteAssigned: 1 - m_MaskInteraction: 0 - m_SpriteSortPoint: 0 ---- !u!4 &597029169 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 597029165} - 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: - - {fileID: 1517903067} - m_Father: {fileID: 0} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &597029170 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 597029165} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ad7f4137b7a3a5f4ab8e0dbabfa58236, type: 3} - m_Name: - m_EditorClassIdentifier: - speed: 5 - boundary: - xMin: -4.868 - xMax: 4.868 - yMin: -0.34 - yMax: 4.9 - Shot: {fileID: 8856353955679083582, guid: 46035d7c8d57a37498081013c50b391f, type: 3} - ShotSpawn: {fileID: 1517903067} - fireRate: 0.25 ---- !u!82 &597029171 +--- !u!82 &590622964 AudioSource: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 597029165} + m_GameObject: {fileID: 590622961} m_Enabled: 1 serializedVersion: 4 OutputAudioMixerGroup: {fileID: 0} - m_audioClip: {fileID: 8300000, guid: 9bc8b66baf0a5694d9f6e6e72b11e0db, type: 3} - m_PlayOnAwake: 0 - m_Volume: 0.5 + m_audioClip: {fileID: 8300000, guid: 14a188bbccd7f1c48bd598a50a4076d7, type: 3} + m_PlayOnAwake: 1 + m_Volume: 1 m_Pitch: 1 - Loop: 0 + Loop: 1 Mute: 0 Spatialize: 0 SpatializePostEffects: 0 @@ -823,6 +682,31 @@ AudioSource: m_PreInfinity: 2 m_PostInfinity: 2 m_RotationOrder: 4 +--- !u!1 &597029165 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 414629805906031132, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + m_PrefabInstance: {fileID: 414629806433665841} + m_PrefabAsset: {fileID: 0} +--- !u!114 &597029172 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 597029165} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9e22954f4d28c134a8c3947b377ebf89, type: 3} + m_Name: + m_EditorClassIdentifier: + explosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, + type: 3} + playerExplosion: {fileID: 4135666156658398521, guid: 797306acff402e74187bde1b00d560bd, + type: 3} + scoreValue: 0 + health: 4 + Player: {fileID: 597029165} --- !u!1 &646078054 GameObject: m_ObjectHideFlags: 0 @@ -981,36 +865,6 @@ SpriteRenderer: m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!1 &1517903066 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1517903067} - m_Layer: 0 - m_Name: ShotSpawn - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1517903067 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1517903066} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0.31, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 597029169} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1559356819 GameObject: m_ObjectHideFlags: 0 @@ -1329,9 +1183,9 @@ RectTransform: m_Father: {fileID: 420651326} m_RootOrder: 3 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: -300, y: -188} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 90, y: 20} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1755535811 @@ -1374,3 +1228,93 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1755535809} m_CullTransparentMesh: 0 +--- !u!1001 &414629806433665841 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 114043405770662276, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: health + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031104, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 414629805906031132, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_Name + value: Player + objectReference: {fileID: 0} + - target: {fileID: 414629805906031135, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_Enabled + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 414629807406309354, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.521 + objectReference: {fileID: 0} + - target: {fileID: 414629807406309355, guid: ede5a6e595cfb3e4fb379acd7616b344, + type: 3} + propertyPath: m_TagString + value: Player + objectReference: {fileID: 0} + m_RemovedComponents: + - {fileID: 114043405770662276, guid: ede5a6e595cfb3e4fb379acd7616b344, type: 3} + m_SourcePrefab: {fileID: 100100000, guid: ede5a6e595cfb3e4fb379acd7616b344, type: 3} diff --git a/Space Shooter/Assets/script/DestroyByContact.cs b/Space Shooter/Assets/script/DestroyByContact.cs index 7c2d432..23a73d6 100644 --- a/Space Shooter/Assets/script/DestroyByContact.cs +++ b/Space Shooter/Assets/script/DestroyByContact.cs @@ -25,29 +25,48 @@ public class DestroyByContact : MonoBehaviour } void OnTriggerEnter2D(Collider2D other) + { - if (other.CompareTag ("Boundary") || other.CompareTag("Enemy")) + if (!this.CompareTag("Player")) { - return; + if (other.CompareTag("Boundary") || other.CompareTag("Enemy")) + { + return; + } } - if (explosion != null) - { - Instantiate(explosion, transform.position, transform.rotation); - } - if (other.tag == "Player") - { - Instantiate(playerExplosion, other.transform.position, other.transform.rotation); - gameController.GameOver(); - } + gameController.AddScore(scoreValue); + if (!other.CompareTag("Player")) + { Destroy(other.gameObject); - Destroy(gameObject); + } + + health--; + if (health <= 0) + { + if (this.tag == "Player") + { + Instantiate(playerExplosion, other.transform.position, other.transform.rotation); + gameController.GameOver(); + + } + + if (explosion != null) + { + Instantiate(explosion, transform.position, transform.rotation); + } + + + Destroy(gameObject); + } } + + } diff --git a/Space Shooter/Assets/script/DestroyByContact2.cs b/Space Shooter/Assets/script/DestroyByContact2.cs new file mode 100644 index 0000000..d846f71 --- /dev/null +++ b/Space Shooter/Assets/script/DestroyByContact2.cs @@ -0,0 +1,15 @@ +using System.Collections; +using UnityEngine; + +public class DestroyByContact2 : MonoBehaviour +{ + void OnTriggerEnter2D(Collider2D other) + { + if (other.CompareTag("Boundary")) + + { + Destroy(other.gameObject); + Destroy(gameObject); + } + } +} diff --git a/Space Shooter/Assets/script/DestroyByContact2.cs.meta b/Space Shooter/Assets/script/DestroyByContact2.cs.meta new file mode 100644 index 0000000..c66d685 --- /dev/null +++ b/Space Shooter/Assets/script/DestroyByContact2.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f472ee69563ec947a0d1eeff67a60a6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Space Shooter/Build/Build/Build.data.unityweb b/Space Shooter/Build/Build/Build.data.unityweb index cf82235..0a576fc 100644 Binary files a/Space Shooter/Build/Build/Build.data.unityweb and b/Space Shooter/Build/Build/Build.data.unityweb differ diff --git a/Space Shooter/Build/Build/Build.wasm.code.unityweb b/Space Shooter/Build/Build/Build.wasm.code.unityweb index 574c9e8..295fbb4 100644 Binary files a/Space Shooter/Build/Build/Build.wasm.code.unityweb and b/Space Shooter/Build/Build/Build.wasm.code.unityweb differ diff --git a/Space Shooter/Build/Build/Build.wasm.framework.unityweb b/Space Shooter/Build/Build/Build.wasm.framework.unityweb index 5798cc5..074a81a 100644 Binary files a/Space Shooter/Build/Build/Build.wasm.framework.unityweb and b/Space Shooter/Build/Build/Build.wasm.framework.unityweb differ diff --git a/Space Shooter/Build/Unity WebGL Player _ Space Shooter - Google Chrome 2020-02-16 19-52-36.mp4 b/Space Shooter/Build/Unity WebGL Player _ Space Shooter - Google Chrome 2020-02-16 19-52-36.mp4 deleted file mode 100644 index cd3c589..0000000 Binary files a/Space Shooter/Build/Unity WebGL Player _ Space Shooter - Google Chrome 2020-02-16 19-52-36.mp4 and /dev/null differ