Destructible Crate Parts

Polish
Sascha 2023-06-16 11:47:10 +07:00
parent c9aebbcf8d
commit 14953a19ec
9 changed files with 24454 additions and 5 deletions

@ -15,7 +15,7 @@ Material:
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_DoubleSidedGI: 1
m_CustomRenderQueue: 2000
stringTagMap:
RenderType: Opaque
@ -91,7 +91,7 @@ Material:
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cull: 0
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
@ -122,6 +122,7 @@ Material:
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &5306222435041310069
MonoBehaviour:
m_ObjectHideFlags: 11

File diff suppressed because it is too large Load Diff

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 603b90faed6758ad5af34fed4418f695
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

@ -6100,10 +6100,16 @@ PrefabInstance:
propertyPath: m_Name
value: Crate
objectReference: {fileID: 0}
- target: {fileID: 9112269570178995488, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: crateDestroyedPrefab
value:
objectReference: {fileID: 9142444727976197465, guid: 603b90faed6758ad5af34fed4418f695,
type: 3}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}
propertyPath: m_LocalPosition.x
value: 8
value: 6
objectReference: {fileID: 0}
- target: {fileID: 9142444727976197465, guid: 1a531e276d6ed5766a7e85e6d4642ff3,
type: 3}

@ -1,8 +1,10 @@
using System;
using Grid;
using UnityEngine;
using Random = UnityEngine.Random;
public class DestructableCrate : MonoBehaviour {
[SerializeField] private Transform crateDestroyedPrefab;
public GridPosition GridPosition { get; private set; }
private void Start() => GridPosition = LevelGrid.Instance.GetGridPosition(transform.position);
@ -10,7 +12,17 @@ public class DestructableCrate : MonoBehaviour {
public static event EventHandler OnAnyDestroyed;
public void Damage() {
Transform crateDestroyedTransform = Instantiate(crateDestroyedPrefab, transform.position, transform.rotation);
ApplyExplosionToChildren(crateDestroyedTransform, Random.Range(150f, 250f), transform.position, Random.Range(10f, 20f));
Destroy(gameObject);
OnAnyDestroyed?.Invoke(this, EventArgs.Empty);
}
private static void ApplyExplosionToChildren(Transform root, float explosionForce, Vector3 explosionPosition, float explosionRadius) {
foreach (Transform child in root) {
if (!child.TryGetComponent(out Rigidbody childRigidbody)) continue;
childRigidbody.AddExplosionForce(explosionForce, explosionPosition, explosionRadius);
ApplyExplosionToChildren(child, explosionForce, explosionPosition, explosionRadius);
}
}
}

@ -3,6 +3,7 @@
"com.unity.2d.sprite": "1.0.0",
"com.unity.cinemachine": "2.9.7",
"com.unity.ide.rider": "3.0.24",
"com.unity.probuilder": "5.0.7",
"com.unity.render-pipelines.universal": "16.0.2",
"com.unity.timeline": "1.8.3",
"com.unity.ugui": "2.0.0",

@ -47,6 +47,17 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.probuilder": {
"version": "5.0.7",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.settings-manager": "1.0.3",
"com.unity.modules.physics": "1.0.0",
"com.unity.modules.imgui": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.render-pipelines.core": {
"version": "16.0.2",
"depth": 1,
@ -77,6 +88,13 @@
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.settings-manager": {
"version": "2.0.1",
"depth": 1,
"source": "registry",
"dependencies": {},
"url": "https://packages.unity.com"
},
"com.unity.shadergraph": {
"version": "16.0.2",
"depth": 1,

@ -0,0 +1,156 @@
{
"m_Dictionary": {
"m_DictionaryValues": [
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "experimental.enabled",
"value": "{\"m_Value\":true}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "lightmapping.autoUnwrapLightmapUV",
"value": "{\"m_Value\":true}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "UnityEngine.ProBuilder.ProBuilderEditor-isUtilityWindow",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.toolbarIconGUI",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.backFaceSelectEnabled",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.showSceneInfo",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "meshImporter.quads",
"value": "{\"m_Value\":true}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "meshImporter.smoothing",
"value": "{\"m_Value\":true}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.showEditorNotifications",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.autoRecalculateCollisions",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "editor.stripProBuilderScriptsOnBuild",
"value": "{\"m_Value\":true}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "mesh.meshColliderIsConvex",
"value": "{\"m_Value\":false}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "mesh.newShapesSnapToGrid",
"value": "{\"m_Value\":true}"
},
{
"type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "experimental.meshesAreAssets",
"value": "{\"m_Value\":false}"
},
{
"type": "UnityEngine.ProBuilder.SemVer, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "about.identifier",
"value": "{\"m_Value\":{\"m_Major\":5,\"m_Minor\":0,\"m_Patch\":7,\"m_Build\":-1,\"m_Type\":\"\",\"m_Metadata\":\"\",\"m_Date\":\"\"}}"
},
{
"type": "UnityEngine.ProBuilder.SemVer, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "preferences.version",
"value": "{\"m_Value\":{\"m_Major\":5,\"m_Minor\":0,\"m_Patch\":7,\"m_Build\":-1,\"m_Type\":\"\",\"m_Metadata\":\"\",\"m_Date\":\"\"}}"
},
{
"type": "UnityEngine.ProBuilder.LogLevel, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "log.level",
"value": "{\"m_Value\":3}"
},
{
"type": "UnityEngine.ProBuilder.LogOutput, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "log.output",
"value": "{\"m_Value\":1}"
},
{
"type": "System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "log.path",
"value": "{\"m_Value\":\"ProBuilderLog.txt\"}"
},
{
"type": "UnityEngine.ProBuilder.RectSelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.dragSelectRectMode",
"value": "{\"m_Value\":0}"
},
{
"type": "UnityEngine.ProBuilder.SelectionModifierBehavior, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.rectSelectModifier",
"value": "{\"m_Value\":2}"
},
{
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.selectMode",
"value": "{\"m_Value\":1}"
},
{
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "meshImporter.smoothingAngle",
"value": "{\"m_Value\":1.0}"
},
{
"type": "System.Single, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"key": "uv.uvEditorGridSnapIncrement",
"value": "{\"m_Value\":0.125}"
},
{
"type": "UnityEngine.ProBuilder.UnwrapParameters, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "lightmapping.defaultLightmapUnwrapParameters",
"value": "{\"m_Value\":{\"m_HardAngle\":88.0,\"m_PackMargin\":20.0,\"m_AngleError\":8.0,\"m_AreaError\":15.0}}"
},
{
"type": "UnityEngine.Material, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.userMaterial",
"value": "{\"m_Value\":{\"instanceID\":0}}"
},
{
"type": "UnityEditor.StaticEditorFlags, UnityEditor.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.defaultStaticEditorFlags",
"value": "{\"m_Value\":0}"
},
{
"type": "UnityEngine.ProBuilder.PivotLocation, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.newShapePivotLocation",
"value": "{\"m_Value\":1}"
},
{
"type": "UnityEngine.Rendering.ShadowCastingMode, UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.shadowCastingMode",
"value": "{\"m_Value\":1}"
},
{
"type": "UnityEngine.ProBuilder.ColliderType, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "mesh.newShapeColliderType",
"value": "{\"m_Value\":2}"
}
]
}
}

@ -146,6 +146,7 @@ PlayerSettings:
isWsaHolographicRemotingEnabled: 0
enableFrameTimingStats: 0
enableOpenGLProfilerGPURecorders: 1
allowHDRDisplaySupport: 0
useHDRDisplay: 0
hdrBitDepth: 0
m_ColorGamuts: 00000000
@ -160,6 +161,7 @@ PlayerSettings:
Standalone: com.Unity-Technologies.com.unity.template.urp-blank
iPhone: com.Unity-Technologies.com.unity.template.urp-blank
buildNumber:
Bratwurst: 0
Standalone: 0
iPhone: 0
tvOS: 0
@ -185,6 +187,8 @@ PlayerSettings:
tvOSSdkVersion: 0
tvOSRequireExtendedGameController: 0
tvOSTargetOSVersionString: 13.0
bratwurstSdkVersion: 0
bratwurstTargetOSVersionString: 13.0
uIPrerenderedIcon: 0
uIRequiresPersistentWiFi: 0
uIRequiresFullScreen: 1
@ -232,8 +236,10 @@ PlayerSettings:
appleDeveloperTeamID:
iOSManualSigningProvisioningProfileID:
tvOSManualSigningProvisioningProfileID:
bratwurstManualSigningProvisioningProfileID:
iOSManualSigningProvisioningProfileType: 0
tvOSManualSigningProvisioningProfileType: 0
bratwurstManualSigningProvisioningProfileType: 0
appleEnableAutomaticSigning: 0
iOSRequireARKit: 0
iOSAutomaticallyDetectAndAddCapabilities: 1
@ -257,6 +263,7 @@ PlayerSettings:
AndroidKeystoreName:
AndroidKeyaliasName:
AndroidEnableArmv9SecurityFeatures: 0
AndroidEnableArm64MTE: 0
AndroidBuildApkPerCpuArchitecture: 0
AndroidTVCompatibility: 0
AndroidIsGame: 1
@ -804,10 +811,13 @@ PlayerSettings:
webGLMemoryLinearGrowthStep: 16
webGLMemoryGeometricGrowthStep: 0.2
webGLMemoryGeometricGrowthCap: 96
webGLEnableWebGPU: 0
webGLPowerPreference: 2
webGLWebAssemblyTable: 0
webGLWebAssemblyBigInt: 0
scriptingDefineSymbols: {}
webGLCloseOnQuit: 0
scriptingDefineSymbols:
Standalone: PROBUILDER_EXPERIMENTAL_FEATURES
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend:
@ -833,7 +843,6 @@ PlayerSettings:
suppressCommonWarnings: 1
allowUnsafeCode: 0
useDeterministicCompilation: 1
selectedPlatform: 0
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 0