diff --git a/Assets/CollisionCheck.cs b/Assets/CollisionCheck.cs index a652378..e8b42a6 100644 --- a/Assets/CollisionCheck.cs +++ b/Assets/CollisionCheck.cs @@ -6,6 +6,7 @@ public class CollisionCheck : MonoBehaviour { public Text health; + public void initText(int hp) { health.text = "Health: " + hp; @@ -17,5 +18,9 @@ public class CollisionCheck : MonoBehaviour { { health.text = "Health: " + gameObject.GetComponent().removeHP(1); } + + } + + } diff --git a/Assets/Graphics/prop_bomb.png b/Assets/Graphics/prop_bomb.png new file mode 100644 index 0000000..de6e4df Binary files /dev/null and b/Assets/Graphics/prop_bomb.png differ diff --git a/Assets/Graphics/prop_bomb.png.meta b/Assets/Graphics/prop_bomb.png.meta new file mode 100644 index 0000000..8c2c847 --- /dev/null +++ b/Assets/Graphics/prop_bomb.png.meta @@ -0,0 +1,56 @@ +fileFormatVersion: 2 +guid: 8217fcaeba65cf24aa654feb2a868f82 +timeCreated: 1448420631 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Graphics/prop_crate_ammo.png b/Assets/Graphics/prop_crate_ammo.png new file mode 100644 index 0000000..71cd1f4 Binary files /dev/null and b/Assets/Graphics/prop_crate_ammo.png differ diff --git a/Assets/Graphics/prop_crate_ammo.png.meta b/Assets/Graphics/prop_crate_ammo.png.meta new file mode 100644 index 0000000..f7bd5ec --- /dev/null +++ b/Assets/Graphics/prop_crate_ammo.png.meta @@ -0,0 +1,56 @@ +fileFormatVersion: 2 +guid: ed2e225ef4e49644392c6f807c4f7c06 +timeCreated: 1448420631 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Graphics/prop_crate_health.png b/Assets/Graphics/prop_crate_health.png new file mode 100644 index 0000000..c7860df Binary files /dev/null and b/Assets/Graphics/prop_crate_health.png differ diff --git a/Assets/Graphics/prop_crate_health.png.meta b/Assets/Graphics/prop_crate_health.png.meta new file mode 100644 index 0000000..bd4ec90 --- /dev/null +++ b/Assets/Graphics/prop_crate_health.png.meta @@ -0,0 +1,56 @@ +fileFormatVersion: 2 +guid: c02a0787a24f5c04a8d64a8260c96f1b +timeCreated: 1448420631 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: .25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 8 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: 1 + nPOTScale: 0 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: .5, y: .5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 1 + textureType: 8 + buildTargetSettings: [] + spriteSheet: + sprites: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 792153f..6421b47 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -31,6 +31,7 @@ GameObject: - 114: {fileID: 11406802} - 114: {fileID: 11472154} - 114: {fileID: 11478382} + - 114: {fileID: 11485758} m_Layer: 8 m_Name: Player m_TagString: Player @@ -165,6 +166,20 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: health: {fileID: 0} +--- !u!114 &11485758 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 197158} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b762a061a54fb144499e3187cbdadc7a, type: 3} + m_Name: + m_EditorClassIdentifier: + bombLaid: 0 + bombCount: 0 + bomb: {fileID: 172872, guid: c08879c52df47d54aa37a52cd902cc42, type: 2} --- !u!212 &21272474 SpriteRenderer: m_ObjectHideFlags: 1 @@ -197,7 +212,11 @@ Prefab: serializedVersion: 2 m_Modification: m_TransformParent: {fileID: 0} - m_Modifications: [] + m_Modifications: + - target: {fileID: 0} + propertyPath: bomb + value: + objectReference: {fileID: 172872, guid: c08879c52df47d54aa37a52cd902cc42, type: 2} m_RemovedComponents: [] m_ParentPrefab: {fileID: 0} m_RootGameObject: {fileID: 197158} diff --git a/Assets/Prefabs/bomb.prefab b/Assets/Prefabs/bomb.prefab new file mode 100644 index 0000000..27c116d --- /dev/null +++ b/Assets/Prefabs/bomb.prefab @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &172872 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 412680} + - 50: {fileID: 5021002} + - 114: {fileID: 11417938} + - 61: {fileID: 6160456} + - 58: {fileID: 5858278} + - 212: {fileID: 21297412} + m_Layer: 0 + m_Name: bomb + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &412680 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 172872} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -.481219798, y: .13448897, z: 0} + m_LocalScale: {x: .0199999996, y: .0199999996, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!50 &5021002 +Rigidbody2D: + serializedVersion: 2 + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 172872} + m_Mass: 1 + m_LinearDrag: 0 + m_AngularDrag: .0500000007 + m_GravityScale: 1 + m_IsKinematic: 0 + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!58 &5858278 +CircleCollider2D: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 172872} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_Offset: {x: 0, y: 0} + serializedVersion: 2 + m_Radius: 4 +--- !u!61 &6160456 +BoxCollider2D: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 172872} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_Offset: {x: 0, y: 0} + serializedVersion: 2 + m_Size: {x: 3.66000009, y: 4.5999999} +--- !u!114 &11417938 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 172872} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b50c00a886c5b1a4196e8364e365416a, type: 3} + m_Name: + m_EditorClassIdentifier: + bombRadius: 10 + bombForce: 100 + fuseTime: 1.5 + explosion: {fileID: 100000, guid: 340a9e7d5164c9c4fba1dc34dc50b866, type: 2} +--- !u!212 &21297412 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 172872} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_ReflectionProbeUsage: 0 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: 8217fcaeba65cf24aa654feb2a868f82, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 0} + propertyPath: m_IsTrigger + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_Radius + value: 4 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 172872} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/bomb.prefab.meta b/Assets/Prefabs/bomb.prefab.meta new file mode 100644 index 0000000..cfee0a1 --- /dev/null +++ b/Assets/Prefabs/bomb.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c08879c52df47d54aa37a52cd902cc42 +timeCreated: 1448424668 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/bombCrate.prefab b/Assets/Prefabs/bombCrate.prefab new file mode 100644 index 0000000..c44666e --- /dev/null +++ b/Assets/Prefabs/bombCrate.prefab @@ -0,0 +1,107 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &176050 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 443498} + - 212: {fileID: 21218118} + - 61: {fileID: 6112162} + - 114: {fileID: 11447590} + - 58: {fileID: 5839892} + m_Layer: 0 + m_Name: bombCrate + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &443498 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 176050} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -.790000021, y: -.170000002, z: 0} + m_LocalScale: {x: .0560000017, y: .0599999987, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!58 &5839892 +CircleCollider2D: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 176050} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_Offset: {x: 0, y: 0} + serializedVersion: 2 + m_Radius: 2.19999981 +--- !u!61 &6112162 +BoxCollider2D: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 176050} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_Offset: {x: 0, y: -.100000001} + serializedVersion: 2 + m_Size: {x: 4.30000019, y: 2.42000008} +--- !u!114 &11447590 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 176050} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2568094dbdb537b49880253a6eedeada, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!212 &21218118 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 176050} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_ReflectionProbeUsage: 0 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: ed2e225ef4e49644392c6f807c4f7c06, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: [] + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 176050} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/bombCrate.prefab.meta b/Assets/Prefabs/bombCrate.prefab.meta new file mode 100644 index 0000000..410500c --- /dev/null +++ b/Assets/Prefabs/bombCrate.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 49b05961cf4702f439a2e17afef7e8d6 +timeCreated: 1448424497 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/healthCrate.prefab b/Assets/Prefabs/healthCrate.prefab new file mode 100644 index 0000000..fb81ee1 --- /dev/null +++ b/Assets/Prefabs/healthCrate.prefab @@ -0,0 +1,136 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &140204 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 423818} + - 212: {fileID: 21237158} + - 61: {fileID: 6101798} + - 114: {fileID: 11495280} + - 58: {fileID: 5810054} + m_Layer: 0 + m_Name: healthCrate + m_TagString: healthCrate + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &423818 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 140204} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: .0480000004, y: -.307000011, z: 0} + m_LocalScale: {x: .0399999991, y: .0399999991, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!58 &5810054 +CircleCollider2D: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 140204} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_Offset: {x: -.5, y: 0} + serializedVersion: 2 + m_Radius: 2.5 +--- !u!61 &6101798 +BoxCollider2D: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 140204} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_Offset: {x: -.5, y: 0} + serializedVersion: 2 + m_Size: {x: 4.5, y: 3.5} +--- !u!114 &11495280 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 140204} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a395f7557cbd20d45826e16e4264ee4a, type: 3} + m_Name: + m_EditorClassIdentifier: + health: {fileID: 0} +--- !u!212 &21237158 +SpriteRenderer: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 140204} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_ReflectionProbeUsage: 0 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: c02a0787a24f5c04a8d64a8260c96f1b, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 0} + propertyPath: m_TagString + value: healthCrate + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_IsTrigger + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_Offset.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_Offset.x + value: -.5 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_Size.x + value: 4.5 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_Size.y + value: 3.5 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_Radius + value: 2.5 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 140204} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/healthCrate.prefab.meta b/Assets/Prefabs/healthCrate.prefab.meta new file mode 100644 index 0000000..32f8572 --- /dev/null +++ b/Assets/Prefabs/healthCrate.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 75b509187cb0a5e478bb560f5c4c63c4 +timeCreated: 1448426012 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/ui_bombHUD.prefab b/Assets/Prefabs/ui_bombHUD.prefab new file mode 100644 index 0000000..312f2a6 --- /dev/null +++ b/Assets/Prefabs/ui_bombHUD.prefab @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &100000 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + serializedVersion: 4 + m_Component: + - 4: {fileID: 400000} + - 131: {fileID: 13100000} + m_Layer: 0 + m_Name: ui_bombHUD + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &400000 +Transform: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + 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: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 +--- !u!131 &13100000 +GUITexture: + m_ObjectHideFlags: 1 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 100100000} + m_GameObject: {fileID: 100000} + m_Enabled: 1 + m_Texture: {fileID: 2800000, guid: ed2e225ef4e49644392c6f807c4f7c06, type: 3} + m_Color: {r: .5, g: .5, b: .5, a: .5} + m_PixelInset: + serializedVersion: 2 + x: 10 + y: 10 + width: 84 + height: 70 + m_LeftBorder: 0 + m_RightBorder: 0 + m_TopBorder: 0 + m_BottomBorder: 0 +--- !u!1001 &100100000 +Prefab: + m_ObjectHideFlags: 1 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 0} + propertyPath: m_Texture + value: + objectReference: {fileID: 2800000, guid: ed2e225ef4e49644392c6f807c4f7c06, type: 3} + - target: {fileID: 0} + propertyPath: m_PixelInset.x + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 0} + propertyPath: m_PixelInset.y + value: 10 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 0} + m_RootGameObject: {fileID: 100000} + m_IsPrefabParent: 1 diff --git a/Assets/Prefabs/ui_bombHUD.prefab.meta b/Assets/Prefabs/ui_bombHUD.prefab.meta new file mode 100644 index 0000000..63e793e --- /dev/null +++ b/Assets/Prefabs/ui_bombHUD.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 78dc943c97f3e184da7d03251424d5a9 +timeCreated: 1448420631 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/JoelScene.unity b/Assets/Scenes/JoelScene.unity index fbf8c96..fb7b918 100644 --- a/Assets/Scenes/JoelScene.unity +++ b/Assets/Scenes/JoelScene.unity @@ -113,7 +113,7 @@ Transform: - {fileID: 1903720196} - {fileID: 1747148540} m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 6 --- !u!1 &328141749 GameObject: m_ObjectHideFlags: 0 @@ -199,7 +199,49 @@ Transform: m_Children: - {fileID: 328141751} m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 5 +--- !u!1001 &755708907 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalPosition.x + value: 1.09026527 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalPosition.y + value: -.227697939 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + m_IsPrefabParent: 0 --- !u!1 &792903395 GameObject: m_ObjectHideFlags: 0 @@ -227,7 +269,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: c1e6722564abf8f4a9aacf7b96cedb6f, type: 3} m_Name: m_EditorClassIdentifier: - player: {fileID: 1189818989} + player: {fileID: 1891629065} cam: {fileID: 1449410197} --- !u!4 &792903397 Transform: @@ -240,7 +282,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 0 + m_RootOrder: 2 --- !u!1001 &849444827 Prefab: m_ObjectHideFlags: 0 @@ -322,13 +364,13 @@ Prefab: propertyPath: m_RootOrder value: 2 objectReference: {fileID: 0} + - target: {fileID: 462904, guid: b7819e17682d74b45a71d6831a413e0b, type: 2} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: b7819e17682d74b45a71d6831a413e0b, type: 2} m_IsPrefabParent: 0 ---- !u!1 &1189818989 stripped -GameObject: - m_PrefabParentObject: {fileID: 101678, guid: b7819e17682d74b45a71d6831a413e0b, type: 2} - m_PrefabInternal: {fileID: 1024525637} --- !u!1001 &1334973125 Prefab: m_ObjectHideFlags: 0 @@ -418,7 +460,7 @@ Transform: m_Children: - {fileID: 458710668} m_Father: {fileID: 0} - m_RootOrder: 5 + m_RootOrder: 7 --- !u!1 &1449410197 GameObject: m_ObjectHideFlags: 0 @@ -505,7 +547,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 2 + m_RootOrder: 4 --- !u!114 &1449410203 MonoBehaviour: m_ObjectHideFlags: 0 @@ -517,7 +559,49 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3119842ed2201b245bb2285416ee9244, type: 3} m_Name: m_EditorClassIdentifier: - player: {fileID: 1189818989} + player: {fileID: 1891629065} +--- !u!1001 &1505017420 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 423818, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + propertyPath: m_LocalPosition.x + value: -1.10767782 + objectReference: {fileID: 0} + - target: {fileID: 423818, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + propertyPath: m_LocalPosition.y + value: -.254000008 + objectReference: {fileID: 0} + - target: {fileID: 423818, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 423818, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 423818, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 423818, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 423818, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 423818, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + m_IsPrefabParent: 0 --- !u!4 &1747148540 stripped Transform: m_PrefabParentObject: {fileID: 417046, guid: 6a21797441b99c942915e70c461edf77, type: 2} @@ -526,6 +610,10 @@ Transform: GameObject: m_PrefabParentObject: {fileID: 167312, guid: 6a21797441b99c942915e70c461edf77, type: 2} m_PrefabInternal: {fileID: 849444827} +--- !u!1 &1891629065 stripped +GameObject: + m_PrefabParentObject: {fileID: 197158, guid: b7819e17682d74b45a71d6831a413e0b, type: 2} + m_PrefabInternal: {fileID: 1024525637} --- !u!4 &1903720196 stripped Transform: m_PrefabParentObject: {fileID: 417046, guid: 6a21797441b99c942915e70c461edf77, type: 2} diff --git a/Assets/Scenes/MasterScene.unity b/Assets/Scenes/MasterScene.unity index d838418..bbd1e53 100644 --- a/Assets/Scenes/MasterScene.unity +++ b/Assets/Scenes/MasterScene.unity @@ -142,6 +142,7 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} m_Children: + - {fileID: 1972685053} - {fileID: 1113329688} m_Father: {fileID: 0} m_RootOrder: 6 @@ -441,6 +442,10 @@ Prefab: propertyPath: health value: objectReference: {fileID: 1113329686} + - target: {fileID: 462904, guid: b7819e17682d74b45a71d6831a413e0b, type: 2} + propertyPath: m_RootOrder + value: 2 + objectReference: {fileID: 0} m_RemovedComponents: [] m_ParentPrefab: {fileID: 100100000, guid: b7819e17682d74b45a71d6831a413e0b, type: 2} m_IsPrefabParent: 0 @@ -510,12 +515,41 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 237529558} - m_RootOrder: 0 + m_RootOrder: 1 m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 87, y: -25} m_SizeDelta: {x: 160, y: 30} m_Pivot: {x: .5, y: .5} +--- !u!1 &1172410436 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1172410437} + m_Layer: 0 + m_Name: Props + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1172410437 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1172410436} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -.481219798, y: .13448897, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 1741172442} + - {fileID: 1736051098} + m_Father: {fileID: 0} + m_RootOrder: 8 --- !u!1 &1235119630 GameObject: m_ObjectHideFlags: 0 @@ -762,6 +796,151 @@ MonoBehaviour: GameObject: m_PrefabParentObject: {fileID: 167312, guid: 6a21797441b99c942915e70c461edf77, type: 2} m_PrefabInternal: {fileID: 849444827} +--- !u!1 &1736051093 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 140204, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1736051098} + - 212: {fileID: 1736051097} + - 61: {fileID: 1736051096} + - 114: {fileID: 1736051095} + - 58: {fileID: 1736051094} + m_Layer: 0 + m_Name: healthCrate + m_TagString: healthCrate + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!58 &1736051094 +CircleCollider2D: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 5810054, guid: 75b509187cb0a5e478bb560f5c4c63c4, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1736051093} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 1 + m_UsedByEffector: 0 + m_Offset: {x: -.5, y: 0} + serializedVersion: 2 + m_Radius: 2.5 +--- !u!114 &1736051095 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11495280, guid: 75b509187cb0a5e478bb560f5c4c63c4, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1736051093} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: a395f7557cbd20d45826e16e4264ee4a, type: 3} + m_Name: + m_EditorClassIdentifier: + health: {fileID: 1113329686} +--- !u!61 &1736051096 +BoxCollider2D: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 6101798, guid: 75b509187cb0a5e478bb560f5c4c63c4, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1736051093} + m_Enabled: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_Offset: {x: -.5, y: 0} + serializedVersion: 2 + m_Size: {x: 4.5, y: 3.5} +--- !u!212 &1736051097 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 21237158, guid: 75b509187cb0a5e478bb560f5c4c63c4, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1736051093} + m_Enabled: 1 + m_CastShadows: 0 + m_ReceiveShadows: 0 + m_Materials: + - {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0} + m_SubsetIndices: + m_StaticBatchRoot: {fileID: 0} + m_UseLightProbes: 0 + m_ReflectionProbeUsage: 0 + m_ProbeAnchor: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 0 + m_ImportantGI: 0 + m_AutoUVMaxDistance: .5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: c02a0787a24f5c04a8d64a8260c96f1b, type: 3} + m_Color: {r: 1, g: 1, b: 1, a: 1} +--- !u!4 &1736051098 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 423818, guid: 75b509187cb0a5e478bb560f5c4c63c4, type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1736051093} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -.531662822, y: -.373635262, z: 0} + m_LocalScale: {x: .0399999991, y: .0399999991, z: 1} + m_Children: [] + m_Father: {fileID: 1172410437} + m_RootOrder: 1 +--- !u!1001 &1741172441 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1172410437} + m_Modifications: + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalPosition.x + value: 1.53600001 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalPosition.y + value: -.354999989 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + m_IsPrefabParent: 0 +--- !u!4 &1741172442 stripped +Transform: + m_PrefabParentObject: {fileID: 443498, guid: 49b05961cf4702f439a2e17afef7e8d6, type: 2} + m_PrefabInternal: {fileID: 1741172441} --- !u!4 &1747148540 stripped Transform: m_PrefabParentObject: {fileID: 417046, guid: 6a21797441b99c942915e70c461edf77, type: 2} @@ -770,6 +949,56 @@ Transform: Transform: m_PrefabParentObject: {fileID: 417046, guid: 6a21797441b99c942915e70c461edf77, type: 2} m_PrefabInternal: {fileID: 849444827} +--- !u!1001 &1972685052 +Prefab: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 237529558} + m_Modifications: + - target: {fileID: 400000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + propertyPath: m_LocalPosition.x + value: -603.5 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + propertyPath: m_LocalPosition.y + value: -235.5 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 400000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 100000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + propertyPath: m_Layer + value: 5 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_ParentPrefab: {fileID: 100100000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + m_IsPrefabParent: 0 +--- !u!4 &1972685053 stripped +Transform: + m_PrefabParentObject: {fileID: 400000, guid: 78dc943c97f3e184da7d03251424d5a9, type: 2} + m_PrefabInternal: {fileID: 1972685052} --- !u!1001 &2106831666 Prefab: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Bomb.cs b/Assets/Scripts/Bomb.cs new file mode 100644 index 0000000..37c3b19 --- /dev/null +++ b/Assets/Scripts/Bomb.cs @@ -0,0 +1,80 @@ +using UnityEngine; +using System.Collections; + +public class Bomb : MonoBehaviour +{ + public float bombRadius = 10f; // Radius within which enemies are killed. + public float bombForce = 100f; // Force that enemies are thrown from the blast. + + public float fuseTime = 1.5f; + public GameObject explosion; // Prefab of explosion effect. + + + private LayBombs layBombs; // Reference to the player's LayBombs script. + + + + + void Awake () + { + if(GameObject.FindGameObjectWithTag("Player")) + layBombs = GameObject.FindGameObjectWithTag("Player").GetComponent(); + } + + void Start () + { + + // If the bomb has no parent, it has been laid by the player and should detonate. + if(transform.root == transform) + StartCoroutine(BombDetonation()); + } + + + IEnumerator BombDetonation() + { + // Wait for 2 seconds. + yield return new WaitForSeconds(fuseTime); + + // Explode the bomb. + Explode(); + } + + + public void Explode() + { + + // The player is now free to lay bombs when he has them. + layBombs.bombLaid = false; + + // Find all the colliders on the Enemies layer within the bombRadius. + Collider2D[] enemies = Physics2D.OverlapCircleAll(transform.position, bombRadius, 1 << LayerMask.NameToLayer("Enemy")); + + // For each collider... + foreach(Collider2D col in enemies) + { + // Check if it has a rigidbody (since there is only one per enemy, on the parent). + Rigidbody2D rb = col.GetComponent(); + if(rb != null && rb.tag == "Enemy") + { + // Find the Enemy script and set the enemy's health to zero. + rb.gameObject.GetComponent().removeHP(1000); + + // Find a vector from the bomb to the enemy. + Vector3 deltaPos = rb.transform.position - transform.position; + + // Apply a force in this direction with a magnitude of bombForce. + Vector3 force = deltaPos.normalized * bombForce; + rb.AddForce(force); + } + } + + // Create a quaternion with a random rotation in the z-axis. + Quaternion randomRotation = Quaternion.Euler (0f, 0f, Random.Range (0f, 360f)); + + // Instantiate the explosion where the rocket is with the random rotation. + Instantiate (explosion, transform.position, randomRotation); + + // Destroy the bomb. + Destroy (gameObject); + } +} diff --git a/Assets/Scripts/Bomb.cs.meta b/Assets/Scripts/Bomb.cs.meta new file mode 100644 index 0000000..1e928f2 --- /dev/null +++ b/Assets/Scripts/Bomb.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b50c00a886c5b1a4196e8364e365416a +timeCreated: 1448420630 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/BombPickup.cs b/Assets/Scripts/BombPickup.cs new file mode 100644 index 0000000..4d116a1 --- /dev/null +++ b/Assets/Scripts/BombPickup.cs @@ -0,0 +1,27 @@ +using UnityEngine; +using System.Collections; + +public class BombPickup : MonoBehaviour +{ + + + void Awake() + { + + } + + + void OnTriggerEnter2D (Collider2D other) + { + // If the player enters the trigger zone... + if(other.tag == "Player") + { + // Increase the number of bombs the player has. + other.GetComponent().bombCount++; + + // Destroy the crate. + Destroy(gameObject); + } + + } +} diff --git a/Assets/Scripts/BombPickup.cs.meta b/Assets/Scripts/BombPickup.cs.meta new file mode 100644 index 0000000..0989e74 --- /dev/null +++ b/Assets/Scripts/BombPickup.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2568094dbdb537b49880253a6eedeada +timeCreated: 1448420630 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/EnemyBehavior.cs b/Assets/Scripts/EnemyBehavior.cs index 38f77f4..f221059 100644 --- a/Assets/Scripts/EnemyBehavior.cs +++ b/Assets/Scripts/EnemyBehavior.cs @@ -8,7 +8,7 @@ public class EnemyBehavior : MonoBehaviour { private bool facingRight = true; private bool dead = false; - private Health hp; + //private Health hp; // Ground @@ -20,7 +20,7 @@ public class EnemyBehavior : MonoBehaviour { rb = GetComponent(); groundBounds = ground.GetComponent().bounds; - hp = GetComponent(); + //hp = GetComponent(); } // Update is called once per frame diff --git a/Assets/Scripts/HealthPickup.cs b/Assets/Scripts/HealthPickup.cs new file mode 100644 index 0000000..764a9fa --- /dev/null +++ b/Assets/Scripts/HealthPickup.cs @@ -0,0 +1,25 @@ +using UnityEngine; +using System.Collections; +using UnityEngine.UI; + + + +public class HealthPickup : MonoBehaviour +{ + + public Text health; + + void OnTriggerEnter2D(Collider2D other) + { + if(other.tag == "Player") + { + // Destroy the crate. + Destroy(gameObject); + + //heal player + health.text = "Health: " + gameObject.GetComponent().addHP(3); + + } + + } +} diff --git a/Assets/Scripts/HealthPickup.cs.meta b/Assets/Scripts/HealthPickup.cs.meta new file mode 100644 index 0000000..af6580a --- /dev/null +++ b/Assets/Scripts/HealthPickup.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: a395f7557cbd20d45826e16e4264ee4a +timeCreated: 1448429002 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/LayBombs.cs b/Assets/Scripts/LayBombs.cs new file mode 100644 index 0000000..bfbfdfa --- /dev/null +++ b/Assets/Scripts/LayBombs.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using System.Collections; + +public class LayBombs : MonoBehaviour +{ + [HideInInspector] + public bool bombLaid = false; // si une bombe a été lancé + public int bombCount = 0; // nombre bomb que le joueur possede + + public GameObject bomb; // Prefab of the bomb. + + + private GUITexture bombHUD; // affiche si le joueur possede une bombe + + + void Awake () + { + // Setting up the reference. + bombHUD = GameObject.Find("ui_bombHUD").GetComponent(); + } + + + void Update () + { + // si le bouton est pressé et qu'aucune bombe n'a été lancé et qu'on a des bombes + if(Input.GetButtonDown("Fire2") && !bombLaid && bombCount > 0) + { + // Decremente le nb de bombe + bombCount--; + + // lance une bombe + bombLaid = true; + + // Instancie la bombe + Instantiate(bomb, transform.position, transform.rotation); + } + + // active le display de bombe si le joueur possede des bombes(true) sinon false + bombHUD.enabled = bombCount > 0; + } +} diff --git a/Assets/Scripts/LayBombs.cs.meta b/Assets/Scripts/LayBombs.cs.meta new file mode 100644 index 0000000..9255a6b --- /dev/null +++ b/Assets/Scripts/LayBombs.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b762a061a54fb144499e3187cbdadc7a +timeCreated: 1448420630 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index f3abab5..24b2ed9 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -8,6 +8,7 @@ PlayerSettings: defaultScreenOrientation: 4 targetDevice: 2 targetResolution: 0 + useOnDemandResources: 0 accelerometerFrequency: 60 companyName: DefaultCompany productName: Laboratoire_2_Equipe_2 @@ -28,6 +29,7 @@ PlayerSettings: androidShowActivityIndicatorOnLoading: -1 iosAppInBackgroundBehavior: 0 displayResolutionDialog: 1 + iosAllowHTTPDownload: 1 allowedAutorotateToPortrait: 1 allowedAutorotateToPortraitUpsideDown: 1 allowedAutorotateToLandscapeRight: 1 @@ -135,6 +137,15 @@ PlayerSettings: iOSLaunchScreenFillPct: 100 iOSLaunchScreenSize: 100 iOSLaunchScreenCustomXibPath: + iOSLaunchScreeniPadType: 0 + iOSLaunchScreeniPadImage: {fileID: 0} + iOSLaunchScreeniPadBackgroundColor: + serializedVersion: 2 + rgba: 0 + iOSLaunchScreeniPadFillPct: 100 + iOSLaunchScreeniPadSize: 100 + iOSLaunchScreeniPadCustomXibPath: + iOSDeviceRequirements: [] AndroidTargetDevice: 0 AndroidSplashScreenScale: 0 androidSplashScreen: {fileID: 0} @@ -224,6 +235,8 @@ PlayerSettings: ps4SdkOverride: ps4BGMPath: ps4ShareFilePath: + ps4ShareOverlayImagePath: + ps4PrivacyGuardImagePath: ps4NPtitleDatPath: ps4RemotePlayKeyAssignment: -1 ps4RemotePlayKeyMappingDir: @@ -245,6 +258,7 @@ PlayerSettings: ps4attribMoveSupport: 0 ps4attrib3DSupport: 0 ps4attribShareSupport: 0 + ps4IncludedModules: [] monoEnv: psp2Splashimage: {fileID: 0} psp2NPTrophyPackPath: diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index e040c5c..8a062e6 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 5.2.0f3 +m_EditorVersion: 5.2.1f1 m_StandardAssetsVersion: 0 diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index a561668..ab46244 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -5,6 +5,7 @@ TagManager: serializedVersion: 2 tags: - Enemy + - healthCrate layers: - Default - TransparentFX