From e17104973196d86b28b4255f8c2354c2bbe4c04b Mon Sep 17 00:00:00 2001 From: Jens Pitkanen Date: Sun, 4 Aug 2019 20:08:13 +0300 Subject: [PATCH] Add bullet force, more bodyparts, health --- Assets/Graphics/OfficeSupplies.png.meta | 168 ++++++++++++++++-- .../Bodyparts/{Big => }/BigBodyPart-1.prefab | 0 .../{Big => }/BigBodyPart-1.prefab.meta | 0 .../Bodyparts/{Big => }/BigBodyPart-2.prefab | 0 .../{Big => }/BigBodyPart-2.prefab.meta | 0 .../Bodyparts/{Big => }/BigBodyPart-3.prefab | 0 .../{Big => }/BigBodyPart-3.prefab.meta | 0 .../Prefabs/Bodyparts/MediumBodyPart-1.prefab | 153 ++++++++++++++++ ...{Big.meta => MediumBodyPart-1.prefab.meta} | 5 +- .../Prefabs/Bodyparts/MediumBodyPart-2.prefab | 152 ++++++++++++++++ .../Bodyparts/MediumBodyPart-2.prefab.meta | 7 + .../Prefabs/Bodyparts/MediumBodyPart-3.prefab | 153 ++++++++++++++++ .../Bodyparts/MediumBodyPart-3.prefab.meta | 7 + .../Enemies/Enemy (Default Melee).prefab | 21 ++- Assets/Scenes/MainScene.unity | 148 +++++++++++++-- Assets/Scripts/BloodLauncher.cs | 2 +- Assets/Scripts/Bullets/RevolverBullet.cs | 9 +- Assets/Scripts/CameraFX.cs | 14 +- Assets/Scripts/ExplodableHealth.cs | 26 +++ Assets/Scripts/ExplodableHealth.cs.meta | 11 ++ 20 files changed, 829 insertions(+), 47 deletions(-) rename Assets/Prefabs/Bodyparts/{Big => }/BigBodyPart-1.prefab (100%) rename Assets/Prefabs/Bodyparts/{Big => }/BigBodyPart-1.prefab.meta (100%) rename Assets/Prefabs/Bodyparts/{Big => }/BigBodyPart-2.prefab (100%) rename Assets/Prefabs/Bodyparts/{Big => }/BigBodyPart-2.prefab.meta (100%) rename Assets/Prefabs/Bodyparts/{Big => }/BigBodyPart-3.prefab (100%) rename Assets/Prefabs/Bodyparts/{Big => }/BigBodyPart-3.prefab.meta (100%) create mode 100644 Assets/Prefabs/Bodyparts/MediumBodyPart-1.prefab rename Assets/Prefabs/Bodyparts/{Big.meta => MediumBodyPart-1.prefab.meta} (57%) create mode 100644 Assets/Prefabs/Bodyparts/MediumBodyPart-2.prefab create mode 100644 Assets/Prefabs/Bodyparts/MediumBodyPart-2.prefab.meta create mode 100644 Assets/Prefabs/Bodyparts/MediumBodyPart-3.prefab create mode 100644 Assets/Prefabs/Bodyparts/MediumBodyPart-3.prefab.meta create mode 100644 Assets/Scripts/ExplodableHealth.cs create mode 100644 Assets/Scripts/ExplodableHealth.cs.meta diff --git a/Assets/Graphics/OfficeSupplies.png.meta b/Assets/Graphics/OfficeSupplies.png.meta index d17cc24..86a129e 100644 --- a/Assets/Graphics/OfficeSupplies.png.meta +++ b/Assets/Graphics/OfficeSupplies.png.meta @@ -1,12 +1,27 @@ fileFormatVersion: 2 guid: 214b62ded47c3424c8ca6f7ac2681d8a TextureImporter: - internalIDToNameTable: [] + internalIDToNameTable: + - first: + 213: -7697855389034428149 + second: OfficeSupplies_0 + - first: + 213: 6990742935623859473 + second: OfficeSupplies_1 + - first: + 213: 2109281845590731511 + second: OfficeSupplies_2 + - first: + 213: 4251926081805609921 + second: OfficeSupplies_3 + - first: + 213: -6877776940356795950 + second: OfficeSupplies_4 externalObjects: {} serializedVersion: 10 mipmaps: mipMapMode: 0 - enableMipMap: 1 + enableMipMap: 0 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 @@ -31,16 +46,16 @@ TextureImporter: maxTextureSize: 2048 textureSettings: serializedVersion: 2 - filterMode: -1 + filterMode: 0 aniso: -1 mipBias: -100 - wrapU: -1 - wrapV: -1 + wrapU: 1 + wrapV: 1 wrapW: -1 - nPOTScale: 1 + nPOTScale: 0 lightmap: 0 compressionQuality: 50 - spriteMode: 0 + spriteMode: 2 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 @@ -49,9 +64,9 @@ TextureImporter: spriteBorder: {x: 0, y: 0, z: 0, w: 0} spriteGenerateFallbackPhysicsShape: 1 alphaUsage: 1 - alphaIsTransparency: 0 + alphaIsTransparency: 1 spriteTessellationDetail: -1 - textureType: 0 + textureType: 8 textureShape: 1 singleChannelComponent: 0 maxTextureSizeSet: 0 @@ -63,7 +78,31 @@ TextureImporter: maxTextureSize: 2048 resizeAlgorithm: 0 textureFormat: -1 - textureCompression: 1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 @@ -72,11 +111,116 @@ TextureImporter: forceMaximumCompressionQuality_BC6H_BC7: 0 spriteSheet: serializedVersion: 2 - sprites: [] + sprites: + - serializedVersion: 2 + name: OfficeSupplies_0 + rect: + serializedVersion: 2 + x: 1 + y: 35 + width: 32 + height: 32 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 8e397248e6334b843bfba07b45839142 + internalID: -7697855389034428149 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: OfficeSupplies_1 + rect: + serializedVersion: 2 + x: 35 + y: 35 + width: 32 + height: 32 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: c445c5c5d3bc0a244ae59414974343fd + internalID: 6990742935623859473 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: OfficeSupplies_2 + rect: + serializedVersion: 2 + x: 69 + y: 35 + width: 32 + height: 32 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 0e4ee9d36b60c3e43a94cbcd3c41cf90 + internalID: 2109281845590731511 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: OfficeSupplies_3 + rect: + serializedVersion: 2 + x: 103 + y: 35 + width: 32 + height: 32 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: 16dd696bf058f0f42887c147d5699bcc + internalID: 4251926081805609921 + vertices: [] + indices: + edges: [] + weights: [] + - serializedVersion: 2 + name: OfficeSupplies_4 + rect: + serializedVersion: 2 + x: 1 + y: 3 + width: 32 + height: 32 + alignment: 0 + pivot: {x: 0, y: 0} + border: {x: 0, y: 0, z: 0, w: 0} + outline: [] + physicsShape: [] + tessellationDetail: 0 + bones: [] + spriteID: d12d4a0c375b74a48acd3b048430b4f4 + internalID: -6877776940356795950 + vertices: [] + indices: + edges: [] + weights: [] outline: [] physicsShape: [] bones: [] - spriteID: + spriteID: f33d40132f6747e40b9781e26f8a1885 internalID: 0 vertices: [] indices: diff --git a/Assets/Prefabs/Bodyparts/Big/BigBodyPart-1.prefab b/Assets/Prefabs/Bodyparts/BigBodyPart-1.prefab similarity index 100% rename from Assets/Prefabs/Bodyparts/Big/BigBodyPart-1.prefab rename to Assets/Prefabs/Bodyparts/BigBodyPart-1.prefab diff --git a/Assets/Prefabs/Bodyparts/Big/BigBodyPart-1.prefab.meta b/Assets/Prefabs/Bodyparts/BigBodyPart-1.prefab.meta similarity index 100% rename from Assets/Prefabs/Bodyparts/Big/BigBodyPart-1.prefab.meta rename to Assets/Prefabs/Bodyparts/BigBodyPart-1.prefab.meta diff --git a/Assets/Prefabs/Bodyparts/Big/BigBodyPart-2.prefab b/Assets/Prefabs/Bodyparts/BigBodyPart-2.prefab similarity index 100% rename from Assets/Prefabs/Bodyparts/Big/BigBodyPart-2.prefab rename to Assets/Prefabs/Bodyparts/BigBodyPart-2.prefab diff --git a/Assets/Prefabs/Bodyparts/Big/BigBodyPart-2.prefab.meta b/Assets/Prefabs/Bodyparts/BigBodyPart-2.prefab.meta similarity index 100% rename from Assets/Prefabs/Bodyparts/Big/BigBodyPart-2.prefab.meta rename to Assets/Prefabs/Bodyparts/BigBodyPart-2.prefab.meta diff --git a/Assets/Prefabs/Bodyparts/Big/BigBodyPart-3.prefab b/Assets/Prefabs/Bodyparts/BigBodyPart-3.prefab similarity index 100% rename from Assets/Prefabs/Bodyparts/Big/BigBodyPart-3.prefab rename to Assets/Prefabs/Bodyparts/BigBodyPart-3.prefab diff --git a/Assets/Prefabs/Bodyparts/Big/BigBodyPart-3.prefab.meta b/Assets/Prefabs/Bodyparts/BigBodyPart-3.prefab.meta similarity index 100% rename from Assets/Prefabs/Bodyparts/Big/BigBodyPart-3.prefab.meta rename to Assets/Prefabs/Bodyparts/BigBodyPart-3.prefab.meta diff --git a/Assets/Prefabs/Bodyparts/MediumBodyPart-1.prefab b/Assets/Prefabs/Bodyparts/MediumBodyPart-1.prefab new file mode 100644 index 0000000..dd2844a --- /dev/null +++ b/Assets/Prefabs/Bodyparts/MediumBodyPart-1.prefab @@ -0,0 +1,153 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1818059612568235499 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4117065251402618012} + - component: {fileID: 7309919154586958387} + - component: {fileID: 2909001883358942225} + m_Layer: 0 + m_Name: MediumBodyPart-1 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4117065251402618012 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818059612568235499} + 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: 6761790136656946052} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!50 &7309919154586958387 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818059612568235499} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 0.4 + m_LinearDrag: 5 + m_AngularDrag: 12 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!58 &2909001883358942225 +CircleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1818059612568235499} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + serializedVersion: 2 + m_Radius: 0.3 +--- !u!1 &5174189092677178822 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6761790136656946052} + - component: {fileID: 2826785095177378283} + m_Layer: 0 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6761790136656946052 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5174189092677178822} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4117065251402618012} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &2826785095177378283 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5174189092677178822} + 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_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: -947994997 + m_SortingLayer: 3 + m_SortingOrder: 0 + m_Sprite: {fileID: -8580675090303374382, guid: f68259633136b6c4bad937f60d3546bc, + 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.32, y: 0.32} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 diff --git a/Assets/Prefabs/Bodyparts/Big.meta b/Assets/Prefabs/Bodyparts/MediumBodyPart-1.prefab.meta similarity index 57% rename from Assets/Prefabs/Bodyparts/Big.meta rename to Assets/Prefabs/Bodyparts/MediumBodyPart-1.prefab.meta index 503f638..d0cf6bf 100644 --- a/Assets/Prefabs/Bodyparts/Big.meta +++ b/Assets/Prefabs/Bodyparts/MediumBodyPart-1.prefab.meta @@ -1,7 +1,6 @@ fileFormatVersion: 2 -guid: d2f40b91b59d35e4d82b09a56c896b63 -folderAsset: yes -DefaultImporter: +guid: 52039c34fdb255843ac78c6010c5ff83 +PrefabImporter: externalObjects: {} userData: assetBundleName: diff --git a/Assets/Prefabs/Bodyparts/MediumBodyPart-2.prefab b/Assets/Prefabs/Bodyparts/MediumBodyPart-2.prefab new file mode 100644 index 0000000..baee147 --- /dev/null +++ b/Assets/Prefabs/Bodyparts/MediumBodyPart-2.prefab @@ -0,0 +1,152 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &960737912245282743 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3264248364569026240} + - component: {fileID: 8150456643613028463} + - component: {fileID: 4337221885725056589} + m_Layer: 0 + m_Name: MediumBodyPart-2 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3264248364569026240 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 960737912245282743} + 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: 5312142899403631064} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!50 &8150456643613028463 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 960737912245282743} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 0.4 + m_LinearDrag: 5 + m_AngularDrag: 12 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!58 &4337221885725056589 +CircleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 960737912245282743} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + serializedVersion: 2 + m_Radius: 0.3 +--- !u!1 &6025913124539146138 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5312142899403631064} + - component: {fileID: 3698848987744752567} + m_Layer: 0 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5312142899403631064 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6025913124539146138} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 3264248364569026240} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &3698848987744752567 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6025913124539146138} + 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_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: -947994997 + m_SortingLayer: 3 + m_SortingOrder: 0 + m_Sprite: {fileID: 261822481497576611, guid: f68259633136b6c4bad937f60d3546bc, 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.32, y: 0.32} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 diff --git a/Assets/Prefabs/Bodyparts/MediumBodyPart-2.prefab.meta b/Assets/Prefabs/Bodyparts/MediumBodyPart-2.prefab.meta new file mode 100644 index 0000000..b46aa7c --- /dev/null +++ b/Assets/Prefabs/Bodyparts/MediumBodyPart-2.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2fb0a649165a8b7429b09809cd8e25c7 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Bodyparts/MediumBodyPart-3.prefab b/Assets/Prefabs/Bodyparts/MediumBodyPart-3.prefab new file mode 100644 index 0000000..3ab01a7 --- /dev/null +++ b/Assets/Prefabs/Bodyparts/MediumBodyPart-3.prefab @@ -0,0 +1,153 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3610142911819508080 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1297044683168239623} + - component: {fileID: 5643233472970686120} + - component: {fileID: 251110318010601610} + m_Layer: 0 + m_Name: MediumBodyPart-3 + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1297044683168239623 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3610142911819508080} + 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: 8571601343068055327} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!50 &5643233472970686120 +Rigidbody2D: + serializedVersion: 4 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3610142911819508080} + m_BodyType: 0 + m_Simulated: 1 + m_UseFullKinematicContacts: 0 + m_UseAutoMass: 0 + m_Mass: 0.4 + m_LinearDrag: 5 + m_AngularDrag: 12 + m_GravityScale: 1 + m_Material: {fileID: 0} + m_Interpolate: 0 + m_SleepingMode: 1 + m_CollisionDetection: 0 + m_Constraints: 0 +--- !u!58 &251110318010601610 +CircleCollider2D: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3610142911819508080} + m_Enabled: 1 + m_Density: 1 + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_UsedByEffector: 0 + m_UsedByComposite: 0 + m_Offset: {x: 0, y: 0} + serializedVersion: 2 + m_Radius: 0.3 +--- !u!1 &7848841613404082525 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8571601343068055327} + - component: {fileID: 871451326223146352} + m_Layer: 0 + m_Name: Sprite + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &8571601343068055327 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7848841613404082525} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1297044683168239623} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &871451326223146352 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7848841613404082525} + 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_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: -947994997 + m_SortingLayer: 3 + m_SortingOrder: 0 + m_Sprite: {fileID: -6252851290386275527, guid: f68259633136b6c4bad937f60d3546bc, + 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.32, y: 0.32} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 diff --git a/Assets/Prefabs/Bodyparts/MediumBodyPart-3.prefab.meta b/Assets/Prefabs/Bodyparts/MediumBodyPart-3.prefab.meta new file mode 100644 index 0000000..67910ab --- /dev/null +++ b/Assets/Prefabs/Bodyparts/MediumBodyPart-3.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a1affae9e5ef819468fdc1f18f63ca7e +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Enemies/Enemy (Default Melee).prefab b/Assets/Prefabs/Enemies/Enemy (Default Melee).prefab index eb56390..45234b1 100644 --- a/Assets/Prefabs/Enemies/Enemy (Default Melee).prefab +++ b/Assets/Prefabs/Enemies/Enemy (Default Melee).prefab @@ -12,6 +12,7 @@ GameObject: - component: {fileID: 592487110401094195} - component: {fileID: 592487110401094194} - component: {fileID: 592487110401094193} + - component: {fileID: 3362493323285318061} - component: {fileID: 592487110401094200} - component: {fileID: 592487110401094199} - component: {fileID: 592487110401094198} @@ -103,10 +104,24 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: BodypartPrefabs: - - {fileID: 90224928841595158, guid: fdbfbe32f3b9e014e9a8da46701b8c40, type: 3} - - {fileID: 1686931270822509091, guid: d9c92df0020929b47bc70b345f15ae8a, type: 3} - - {fileID: 6593460322437365382, guid: 3ea043b2b1dd80f45bb8198c3e7ada37, type: 3} + - {fileID: 1818059612568235499, guid: 52039c34fdb255843ac78c6010c5ff83, type: 3} + - {fileID: 960737912245282743, guid: 2fb0a649165a8b7429b09809cd8e25c7, type: 3} + - {fileID: 3610142911819508080, guid: a1affae9e5ef819468fdc1f18f63ca7e, type: 3} DebugExplode: 0 +--- !u!114 &3362493323285318061 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 592487110401094192} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7d43d0a4a6d1e2d46a74083bdecde13e, type: 3} + m_Name: + m_EditorClassIdentifier: + MaxHealth: 3 + CurrentHealth: 3 --- !u!114 &592487110401094200 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 4b7478c..09f56ed 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -5614,7 +5614,7 @@ PrefabInstance: - target: {fileID: 4462327694118370271, guid: 7b3529c1a7d22d143a060281857bbca5, type: 3} propertyPath: m_RootOrder - value: 7 + value: 8 objectReference: {fileID: 0} - target: {fileID: 4462327694118370271, guid: 7b3529c1a7d22d143a060281857bbca5, type: 3} @@ -5688,7 +5688,7 @@ PrefabInstance: - target: {fileID: 8489029732530782807, guid: 14a47f86f9e45da45863a81716f2378b, type: 3} propertyPath: m_RootOrder - value: 6 + value: 7 objectReference: {fileID: 0} - target: {fileID: 8489029732530782807, guid: 14a47f86f9e45da45863a81716f2378b, type: 3} @@ -5824,7 +5824,7 @@ Transform: - {fileID: 203480853} - {fileID: 628992541} m_Father: {fileID: 0} - m_RootOrder: 4 + m_RootOrder: 5 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &628992540 GameObject: @@ -5933,8 +5933,8 @@ Tilemap: m_Tiles: - first: {x: -5, y: -6, z: 0} second: - m_TileIndex: 11 - m_TileSpriteIndex: 11 + m_TileIndex: 10 + m_TileSpriteIndex: 10 m_TileMatrixIndex: 0 m_TileColorIndex: 8 m_ObjectToInstantiate: {fileID: 0} @@ -6030,6 +6030,24 @@ Tilemap: m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 m_ColliderType: 1 + - first: {x: -5, y: -5, z: 0} + second: + m_TileIndex: 19 + m_TileSpriteIndex: 19 + m_TileMatrixIndex: 0 + m_TileColorIndex: 8 + m_ObjectToInstantiate: {fileID: 0} + m_TileFlags: 1 + m_ColliderType: 1 + - first: {x: 4, y: -5, z: 0} + second: + m_TileIndex: 18 + m_TileSpriteIndex: 18 + m_TileMatrixIndex: 0 + m_TileColorIndex: 8 + m_ObjectToInstantiate: {fileID: 0} + m_TileFlags: 1 + m_ColliderType: 1 - first: {x: 5, y: -5, z: 0} second: m_TileIndex: 12 @@ -6048,6 +6066,15 @@ Tilemap: m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 m_ColliderType: 1 + - first: {x: -6, y: -4, z: 0} + second: + m_TileIndex: 19 + m_TileSpriteIndex: 19 + m_TileMatrixIndex: 0 + m_TileColorIndex: 8 + m_ObjectToInstantiate: {fileID: 0} + m_TileFlags: 1 + m_ColliderType: 1 - first: {x: -3, y: -4, z: 0} second: m_TileIndex: 4 @@ -6057,6 +6084,15 @@ Tilemap: m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 m_ColliderType: 1 + - first: {x: 5, y: -4, z: 0} + second: + m_TileIndex: 18 + m_TileSpriteIndex: 18 + m_TileMatrixIndex: 0 + m_TileColorIndex: 8 + m_ObjectToInstantiate: {fileID: 0} + m_TileFlags: 1 + m_ColliderType: 1 - first: {x: 6, y: -4, z: 0} second: m_TileIndex: 12 @@ -6309,6 +6345,24 @@ Tilemap: m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 m_ColliderType: 1 + - first: {x: -6, y: 4, z: 0} + second: + m_TileIndex: 16 + m_TileSpriteIndex: 16 + m_TileMatrixIndex: 0 + m_TileColorIndex: 8 + m_ObjectToInstantiate: {fileID: 0} + m_TileFlags: 1 + m_ColliderType: 1 + - first: {x: 5, y: 4, z: 0} + second: + m_TileIndex: 17 + m_TileSpriteIndex: 17 + m_TileMatrixIndex: 0 + m_TileColorIndex: 8 + m_ObjectToInstantiate: {fileID: 0} + m_TileFlags: 1 + m_ColliderType: 1 - first: {x: 6, y: 4, z: 0} second: m_TileIndex: 7 @@ -6327,6 +6381,24 @@ Tilemap: m_ObjectToInstantiate: {fileID: 0} m_TileFlags: 1 m_ColliderType: 1 + - first: {x: -5, y: 5, z: 0} + second: + m_TileIndex: 16 + m_TileSpriteIndex: 16 + m_TileMatrixIndex: 0 + m_TileColorIndex: 8 + m_ObjectToInstantiate: {fileID: 0} + m_TileFlags: 1 + m_ColliderType: 1 + - first: {x: 4, y: 5, z: 0} + second: + m_TileIndex: 17 + m_TileSpriteIndex: 17 + m_TileMatrixIndex: 0 + m_TileColorIndex: 8 + m_ObjectToInstantiate: {fileID: 0} + m_TileFlags: 1 + m_ColliderType: 1 - first: {x: 5, y: 5, z: 0} second: m_TileIndex: 7 @@ -6448,9 +6520,9 @@ Tilemap: m_Data: {fileID: 11400000, guid: a4e6e36b058581b49bc8b9eaf932f645, type: 2} - m_RefCount: 3 m_Data: {fileID: 11400000, guid: 4d53eff1c848abe46bd710718782f295, type: 2} - - m_RefCount: 2 + - m_RefCount: 3 m_Data: {fileID: 11400000, guid: 267300ce7c514bf47878802bf14e391f, type: 2} - - m_RefCount: 9 + - m_RefCount: 8 m_Data: {fileID: 11400000, guid: feb24d6900738d146ab6c5ecbb272804, type: 2} - m_RefCount: 3 m_Data: {fileID: 11400000, guid: 5846d1e3813baa34bb09dddbb4208e0d, type: 2} @@ -6460,6 +6532,14 @@ Tilemap: m_Data: {fileID: 11400000, guid: 7f847e8330ddf5f4a83adf1dd94f3aa6, type: 2} - m_RefCount: 1 m_Data: {fileID: 11400000, guid: 3a266bd53dfebcf479f723737979e62d, type: 2} + - m_RefCount: 2 + m_Data: {fileID: 11400000, guid: 2a8714adf92a036498276febc5b8fe40, type: 2} + - m_RefCount: 2 + m_Data: {fileID: 11400000, guid: ee3b3b54dbc19ac448a0b3ba8c05e76b, type: 2} + - m_RefCount: 2 + m_Data: {fileID: 11400000, guid: 5c71150459033c84baadfd416ab50b31, type: 2} + - m_RefCount: 2 + m_Data: {fileID: 11400000, guid: 036a2061fce4e2d4db7e0808603882b5, type: 2} m_TileSpriteArray: - m_RefCount: 2 m_Data: {fileID: -6315978382755026507, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, @@ -6490,10 +6570,10 @@ Tilemap: - m_RefCount: 3 m_Data: {fileID: 5682393469540925955, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, type: 3} - - m_RefCount: 2 + - m_RefCount: 3 m_Data: {fileID: -8442174482077232629, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, type: 3} - - m_RefCount: 9 + - m_RefCount: 8 m_Data: {fileID: -6936079216851816805, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, type: 3} - m_RefCount: 3 @@ -6508,8 +6588,20 @@ Tilemap: - m_RefCount: 1 m_Data: {fileID: -8025435653959805260, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, type: 3} + - m_RefCount: 2 + m_Data: {fileID: -4087309676702264633, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, + type: 3} + - m_RefCount: 2 + m_Data: {fileID: -9164683769879867358, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, + type: 3} + - m_RefCount: 2 + m_Data: {fileID: -6056380807486736462, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, + type: 3} + - m_RefCount: 2 + m_Data: {fileID: -8480404140891905064, guid: 3b5f43ce65db7e74f9d3a906dfc2c460, + type: 3} m_TileMatrixArray: - - m_RefCount: 55 + - m_RefCount: 63 m_Data: e00: 1 e01: 0 @@ -6544,7 +6636,7 @@ Tilemap: m_Data: {r: 0, g: 0, b: 0, a: 0} - m_RefCount: 0 m_Data: {r: 0, g: 0, b: 0, a: 0} - - m_RefCount: 55 + - m_RefCount: 63 m_Data: {r: 1, g: 1, b: 1, a: 1} m_AnimationFrameRate: 1 m_Color: {r: 1, g: 1, b: 1, a: 1} @@ -6688,8 +6780,36 @@ MonoBehaviour: m_EditorClassIdentifier: Player: {fileID: 370761190} ShakeHandle: {fileID: 139250670} - DebugShake: 0 - DebugSlowDown: 0 +--- !u!1 &1041701589 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1041701590} + m_Layer: 0 + m_Name: Decorations + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1041701590 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1041701589} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &1485325071 PrefabInstance: m_ObjectHideFlags: 0 @@ -6966,7 +7086,7 @@ PrefabInstance: - target: {fileID: 592487110401094196, guid: 1a0e05447c8cf2a4fa9b9dc697884a66, type: 3} propertyPath: m_RootOrder - value: 5 + value: 6 objectReference: {fileID: 0} - target: {fileID: 592487110401094196, guid: 1a0e05447c8cf2a4fa9b9dc697884a66, type: 3} diff --git a/Assets/Scripts/BloodLauncher.cs b/Assets/Scripts/BloodLauncher.cs index 6c70f4f..bb44d7c 100644 --- a/Assets/Scripts/BloodLauncher.cs +++ b/Assets/Scripts/BloodLauncher.cs @@ -30,7 +30,7 @@ namespace Saltosion.OneWeapon { float Intensity = Mathf.Pow(Random.value * force, 1.1f); float Cone = degrees / 360.0f; float Offset = Mathf.Atan2(direction.y, direction.x); - float Radians = Offset + Cone * (Random.value - 0.5f) * Mathf.PI * 2.0f; + float Radians = Offset + Mathf.Pow(Cone * (Random.value - 0.5f) * 2f, 2f) * Mathf.PI * 2.0f; Particle.LaunchForce = new Vector2(Mathf.Cos(Radians), Mathf.Sin(Radians)) * Intensity; } } diff --git a/Assets/Scripts/Bullets/RevolverBullet.cs b/Assets/Scripts/Bullets/RevolverBullet.cs index 5c6c031..a78c0b2 100644 --- a/Assets/Scripts/Bullets/RevolverBullet.cs +++ b/Assets/Scripts/Bullets/RevolverBullet.cs @@ -45,11 +45,18 @@ namespace Saltosion.OneWeapon.Bullets { // Do damage here, kill everyone Explodable Explodable = collider.GetComponent(); - if (Explodable != null) { + ExplodableHealth Health = collider.GetComponent(); + Vector2 Direction = (collider.transform.position - transform.position).normalized; + if (Health != null) { + Health.Damage(1f, -Direction); + } else if (Explodable != null) { Explodable.Explode(true); } else if (collider.tag == "Environment") { BloodLauncher.DebrisExplode(transform.position, Body.velocity.normalized * 0.7f, 5, 30f, 360); } + if (collider.attachedRigidbody != null && collider.attachedRigidbody.bodyType == RigidbodyType2D.Dynamic) { + collider.attachedRigidbody.AddForce(Direction * 4f, ForceMode2D.Impulse); + } } } } diff --git a/Assets/Scripts/CameraFX.cs b/Assets/Scripts/CameraFX.cs index d94bb33..e89b974 100644 --- a/Assets/Scripts/CameraFX.cs +++ b/Assets/Scripts/CameraFX.cs @@ -8,9 +8,6 @@ namespace Saltosion.OneWeapon { public Transform Player; public Transform ShakeHandle; - public bool DebugShake = false; - public bool DebugSlowDown = false; - private Camera Camera; private Vector3 Offset; @@ -24,15 +21,6 @@ namespace Saltosion.OneWeapon { } private void Update() { - if (DebugShake) { - DebugShake = false; - ScreenShake(10f); - } - if (DebugSlowDown) { - DebugSlowDown = false; - StopFor(10f); - } - if (TimeStopCooldown > 0) { TimeStopCooldown -= Time.deltaTime / Time.timeScale; if (TimeStopCooldown <= 0) { @@ -40,7 +28,7 @@ namespace Saltosion.OneWeapon { } } - Vector2 TargetPosition = (Player.position + Camera.ScreenToWorldPoint(Input.mousePosition)) / 2.0f; + Vector2 TargetPosition = (Player.position * 2f + Camera.ScreenToWorldPoint(Input.mousePosition)) / 3.0f; transform.position = Vector3.Lerp(transform.position, TargetPosition, 5f * Time.deltaTime / Time.timeScale) + Offset; if (ScreenShakeTime > 0) { diff --git a/Assets/Scripts/ExplodableHealth.cs b/Assets/Scripts/ExplodableHealth.cs new file mode 100644 index 0000000..7e02382 --- /dev/null +++ b/Assets/Scripts/ExplodableHealth.cs @@ -0,0 +1,26 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace Saltosion.OneWeapon { + [RequireComponent(typeof(Explodable))] + public class ExplodableHealth : MonoBehaviour { + public float MaxHealth; + public float CurrentHealth; + + private Explodable Explodable; + + private void Start() { + Explodable = GetComponent(); + } + + public void Damage(float amount, Vector2 fromDirection) { + BloodLauncher.Splatter(transform.position, -fromDirection, (int)(10 * amount), 100f, 100); + MaxHealth -= amount; + if (MaxHealth <= 0) { + MaxHealth = 0; + Explodable.Explode(true); + } + } + } +} diff --git a/Assets/Scripts/ExplodableHealth.cs.meta b/Assets/Scripts/ExplodableHealth.cs.meta new file mode 100644 index 0000000..cd3db9c --- /dev/null +++ b/Assets/Scripts/ExplodableHealth.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7d43d0a4a6d1e2d46a74083bdecde13e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: