From 2864f443494201461ffeb7ec752aa5967bf91631 Mon Sep 17 00:00:00 2001 From: Jens Pitkanen Date: Sun, 4 Aug 2019 17:14:48 +0300 Subject: [PATCH] Add structural damage particles --- Assets/Graphics/StrucuralDamage.png | Bin 0 -> 5115 bytes Assets/Graphics/StrucuralDamage.png.meta | 115 ++++++++++++++++ .../Prefabs/StructuralDamageParticle.prefab | 128 ++++++++++++++++++ .../StructuralDamageParticle.prefab.meta | 7 + Assets/Scenes/MainScene.unity | 2 + Assets/Scripts/BloodLauncher.cs | 11 +- Assets/Scripts/Bullets/RevolverBullet.cs | 2 + 7 files changed, 264 insertions(+), 1 deletion(-) create mode 100644 Assets/Graphics/StrucuralDamage.png create mode 100644 Assets/Graphics/StrucuralDamage.png.meta create mode 100644 Assets/Prefabs/StructuralDamageParticle.prefab create mode 100644 Assets/Prefabs/StructuralDamageParticle.prefab.meta diff --git a/Assets/Graphics/StrucuralDamage.png b/Assets/Graphics/StrucuralDamage.png new file mode 100644 index 0000000000000000000000000000000000000000..8fd86552c0c633ce736b1b21e515a2dcbc5fe187 GIT binary patch literal 5115 zcmeHLdsGu=77s546kn@|h!TUSbe&8d6Y^*RLZFgr1R(;_2M&`7nUZAU%#Z}E)%sdd zeDzS)YOC0453b+~t@vV(?LvLk7g7};)n%!oi=v(?3Y7gOM2NerUC-J6$DA{n`R@0- zzkBC5_kJ^zf}|N!1N?*iIUG)aCLt~v96j0Hm;LRyxPj(yy#AE0OJ|Z%JJ(8)2Ev4M znLI1b#T|r!!*SG?7o)a&lLjvB%o$PPJ$~GfQ^ziUE`D=;vBY>KMH6vzd3fOV$`)%#ZZy5T?U_uUQT4p({5Wew+1LY{zFx36 z6mzV89ND02ZH`E~V)&kFE)}nB{rsj5nV1|k!B;G(8Bn*Vq!A7BcMK(oPnkj0XI7d{23uFFx5QQj zmhZ0GEc8)6yEXJvb%fDxY2iKU{=Ku`C!TC7idvUBb8}kzs?GwWd33(*&cxUzwDV4O zTT89@!WUO-Pe-T>Rj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JKZy-Bg}XTgR-&-C6S0+B$Wz8a=Ab*koAC4af$|Y%d!due8f4S z#}sb?N)(h2VMeoY*lNjkPJpBpY6?dglG2f+NyTH6; zmTVlXlddLtVJCX2S5zVuNX0Taq?e#l2$9I85Gpe0Aw-CXWswp@f<|_gR5v?K8W=lD z;W62ui@<#bJ>*Mx%}I-{9*#$TzTVX@CZpMltc}jG8pFpGF+lyE)fRFh(x>BA@p0ppgI+ ssELcw`Ch^hp%4YzvyL{YmzNhOaJ$#$%#iiX0Kw73&xqR@J7>|q01_o+z5oCK literal 0 HcmV?d00001 diff --git a/Assets/Graphics/StrucuralDamage.png.meta b/Assets/Graphics/StrucuralDamage.png.meta new file mode 100644 index 0000000..0178349 --- /dev/null +++ b/Assets/Graphics/StrucuralDamage.png.meta @@ -0,0 +1,115 @@ +fileFormatVersion: 2 +guid: f8a4bf070a9e5074ea5c34f079dfb234 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 2 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + 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: 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 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/StructuralDamageParticle.prefab b/Assets/Prefabs/StructuralDamageParticle.prefab new file mode 100644 index 0000000..ba30d34 --- /dev/null +++ b/Assets/Prefabs/StructuralDamageParticle.prefab @@ -0,0 +1,128 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6669388256411233052 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6669388256411233038} + - component: {fileID: 6669388256411233138} + m_Layer: 0 + m_Name: Graphic + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6669388256411233038 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6669388256411233052} + 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: 6669388256411233039} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!212 &6669388256411233138 +SpriteRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6669388256411233052} + 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: -1695068835 + m_SortingLayer: 2 + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: f8a4bf070a9e5074ea5c34f079dfb234, 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.0625, y: 0.0625} + m_AdaptiveModeThreshold: 0.5 + m_SpriteTileMode: 0 + m_WasSpriteAssigned: 1 + m_MaskInteraction: 0 + m_SpriteSortPoint: 0 +--- !u!1 &6669388256411233053 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6669388256411233039} + - component: {fileID: 6669388256411233133} + m_Layer: 0 + m_Name: StructuralDamageParticle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &6669388256411233039 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6669388256411233053} + 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: 6669388256411233038} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &6669388256411233133 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6669388256411233053} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 80990fbdf3a57074b86edf353dcec609, type: 3} + m_Name: + m_EditorClassIdentifier: + LaunchForce: {x: 0, y: 0} + Settled: 0 diff --git a/Assets/Prefabs/StructuralDamageParticle.prefab.meta b/Assets/Prefabs/StructuralDamageParticle.prefab.meta new file mode 100644 index 0000000..6096d17 --- /dev/null +++ b/Assets/Prefabs/StructuralDamageParticle.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 0a46972e02ebee74a96fb9ddc3e2e1af +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index ed5cbe4..3782277 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -340,6 +340,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 21e2caeaa9214014db9c9a8bebd7e2e3, type: 3} m_Name: m_EditorClassIdentifier: + StructuralParticlePrefab: {fileID: 6669388256411233053, guid: 0a46972e02ebee74a96fb9ddc3e2e1af, + type: 3} BloodParticlePrefab: {fileID: 5625006176899801348, guid: 3eace925ee10ebb4da4f6d8f8ce22f5a, type: 3} CensoredBloodParticlePrefab: {fileID: 1882677610906969932, guid: 079fe6df2fbccbe4198535d6e8793dca, diff --git a/Assets/Scripts/BloodLauncher.cs b/Assets/Scripts/BloodLauncher.cs index 133653c..6c70f4f 100644 --- a/Assets/Scripts/BloodLauncher.cs +++ b/Assets/Scripts/BloodLauncher.cs @@ -5,6 +5,7 @@ using UnityEngine; namespace Saltosion.OneWeapon { public class BloodLauncher : MonoBehaviour { private static BloodLauncher Singleton; + public GameObject StructuralParticlePrefab; public GameObject BloodParticlePrefab; public GameObject CensoredBloodParticlePrefab; public Transform ParticleRoot; @@ -12,11 +13,19 @@ namespace Saltosion.OneWeapon { public bool DebugLaunch = false; public static void Splatter(Vector2 origin, Vector2 direction, int particleCount, float force, float degrees) { + LaunchParticles(Singleton.GetGorePrefab(), origin, direction, particleCount, force, degrees); + } + + public static void DebrisExplode(Vector2 origin, Vector2 direction, int particleCount, float force, float degrees) { + LaunchParticles(Singleton.StructuralParticlePrefab, origin, direction, particleCount, force, degrees); + } + + private static void LaunchParticles(GameObject prefab, Vector2 origin, Vector2 direction, int particleCount, float force, float degrees) { for (int i = 0; i < (int)(particleCount * Singleton.GetParticleCountMultiplier()); i++) { if (Singleton.ParticleRoot.childCount >= Singleton.MaxParticles) { Destroy(Singleton.ParticleRoot.GetChild((int)(Random.value * Singleton.ParticleRoot.childCount)).gameObject); } - GameObject Obj = Instantiate(Singleton.GetGorePrefab(), origin, new Quaternion(), Singleton.ParticleRoot); + GameObject Obj = Instantiate(prefab, origin, new Quaternion(), Singleton.ParticleRoot); BloodParticle Particle = Obj.GetComponent(); float Intensity = Mathf.Pow(Random.value * force, 1.1f); float Cone = degrees / 360.0f; diff --git a/Assets/Scripts/Bullets/RevolverBullet.cs b/Assets/Scripts/Bullets/RevolverBullet.cs index 5fdfbae..30c130e 100644 --- a/Assets/Scripts/Bullets/RevolverBullet.cs +++ b/Assets/Scripts/Bullets/RevolverBullet.cs @@ -47,6 +47,8 @@ namespace Saltosion.OneWeapon.Bullets { Explodable Explodable = collider.GetComponent(); if (Explodable != null) { Explodable.Explode(true); + } else { + BloodLauncher.DebrisExplode(transform.position, Body.velocity.normalized * 0.7f, 5, 30f, 360); } } }