From 263c53245e86039b0c82964e4dccad355d93305c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Tue, 11 Jun 2019 20:01:43 +0300 Subject: [PATCH] Implement destructible wall interaction --- Assets/Animations/Ammo/Explosion.controller | 2 +- Assets/DevMocks/bman_wall.png | Bin 434 -> 0 bytes ...bman_wall.prefab => exitDoorPrefab.prefab} | 75 ++------- ...prefab.meta => exitDoorPrefab.prefab.meta} | 2 +- Assets/DevMocks/old_door.png | Bin 0 -> 948 bytes .../{bman_wall.png.meta => old_door.png.meta} | 4 +- Assets/Prefabs/Managers.meta | 8 + Assets/Prefabs/Managers/GameManager.prefab | 65 ++++++++ .../Prefabs/Managers/GameManager.prefab.meta | 7 + .../Walls/bman_destructible_wall1.prefab | 4 + .../Walls/bman_destructible_wall2.prefab | 4 + Assets/Scenes/SampleScene.unity | 142 ++++++++++-------- Assets/Scripts/src/Wall/DestructibleWall.cs | 18 ++- 13 files changed, 197 insertions(+), 134 deletions(-) delete mode 100644 Assets/DevMocks/bman_wall.png rename Assets/DevMocks/{bman_wall.prefab => exitDoorPrefab.prefab} (50%) rename Assets/DevMocks/{bman_wall.prefab.meta => exitDoorPrefab.prefab.meta} (74%) create mode 100644 Assets/DevMocks/old_door.png rename Assets/DevMocks/{bman_wall.png.meta => old_door.png.meta} (96%) create mode 100644 Assets/Prefabs/Managers.meta create mode 100644 Assets/Prefabs/Managers/GameManager.prefab create mode 100644 Assets/Prefabs/Managers/GameManager.prefab.meta diff --git a/Assets/Animations/Ammo/Explosion.controller b/Assets/Animations/Ammo/Explosion.controller index aa3fdbd..3a149bb 100644 --- a/Assets/Animations/Ammo/Explosion.controller +++ b/Assets/Animations/Ammo/Explosion.controller @@ -59,7 +59,7 @@ AnimatorStateMachine: m_ChildStates: - serializedVersion: 1 m_State: {fileID: 1102162894460579672} - m_Position: {x: 200, y: 0, z: 0} + m_Position: {x: 240, y: 48, z: 0} m_ChildStateMachines: [] m_AnyStateTransitions: [] m_EntryTransitions: [] diff --git a/Assets/DevMocks/bman_wall.png b/Assets/DevMocks/bman_wall.png deleted file mode 100644 index c62a6c056a5930f61e854a5a79bd4d2a404d0183..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 434 zcmV;j0ZsmiP)Px$Y)M2xR9J=0S1oVDFc7^=CP4va)p$uq2TDqZw~=XV(zM?c5*9MG{S7TCC~Zl2 z6=o0=xRJT@JiECMx9WqDbMM7>@9vU)u2x^bz;<_l{bmi5=?umr9X(g*{A3)}nV!Rs zMl8M+rkd8ARX_}#>7md$sQqRw4rV{%R4QU3)Z51^nb2PAV!jLtp+HdxrDSLUl){vz zkmUmR>nGD0+~3{u1#n1xaIIYEJdF*T){q?l@Z*9MHk629*%08j75gH{0zwZj>H-d_ z3$Y7Q3?qpPZp7>Ybf)JC@QY1iG|>B^U%swl{H}d z3(5uddP9qc|GpKp-5pT7;;|1wsZ;BVgj zT)O97F++I|3h>FPewMzEYDCzeoXME92st%?ZbU<<%6jlWF@z-J_$r2x1?4xbX$^iY c=L#9ZH-i`8<#iO#^#A|>07*qoM6N<$g7%HU#{d8T diff --git a/Assets/DevMocks/bman_wall.prefab b/Assets/DevMocks/exitDoorPrefab.prefab similarity index 50% rename from Assets/DevMocks/bman_wall.prefab rename to Assets/DevMocks/exitDoorPrefab.prefab index a10ea61..702df4e 100644 --- a/Assets/DevMocks/bman_wall.prefab +++ b/Assets/DevMocks/exitDoorPrefab.prefab @@ -1,6 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &5959564480851182330 +--- !u!1 &1538214466168189615 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -8,38 +8,36 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 5959564480851182334} - - component: {fileID: 5959564480851182333} - - component: {fileID: 5959564480851182332} - - component: {fileID: 5959564480851182331} - m_Layer: 8 - m_Name: bman_wall + - component: {fileID: 3243993883904879596} + - component: {fileID: 3212428174306319952} + m_Layer: 0 + m_Name: exitDoorPrefab m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!4 &5959564480851182334 +--- !u!4 &3243993883904879596 Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5959564480851182330} + m_GameObject: {fileID: 1538214466168189615} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 5, y: 0, z: 0} + m_LocalPosition: {x: 10.299996, y: -4.6040254, z: -0.13553935} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!212 &5959564480851182333 +--- !u!212 &3212428174306319952 SpriteRenderer: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5959564480851182330} + m_GameObject: {fileID: 1538214466168189615} m_Enabled: 1 m_CastShadows: 0 m_ReceiveShadows: 0 @@ -69,62 +67,15 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 9 - m_Sprite: {fileID: 21300000, guid: 96d3693302b284c92ba9c394bb4f72c1, type: 3} + m_SortingOrder: 0 + m_Sprite: {fileID: 21300000, guid: ac1b266a61f9d43feb33de3a91647f99, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 1, y: 1} + m_Size: {x: 0.32, y: 0.32} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 m_MaskInteraction: 0 m_SpriteSortPoint: 0 ---- !u!50 &5959564480851182332 -Rigidbody2D: - serializedVersion: 4 - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5959564480851182330} - m_BodyType: 2 - m_Simulated: 1 - m_UseFullKinematicContacts: 0 - m_UseAutoMass: 0 - m_Mass: 1 - m_LinearDrag: 0 - m_AngularDrag: 0.05 - m_GravityScale: 0 - m_Material: {fileID: 0} - m_Interpolate: 0 - m_SleepingMode: 1 - m_CollisionDetection: 0 - m_Constraints: 0 ---- !u!61 &5959564480851182331 -BoxCollider2D: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5959564480851182330} - m_Enabled: 1 - m_Density: 1 - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_UsedByEffector: 0 - m_UsedByComposite: 0 - m_Offset: {x: 0.5, y: 0.5} - m_SpriteTilingProperty: - border: {x: 0, y: 0, z: 0, w: 0} - pivot: {x: 0, y: 0} - oldSize: {x: 1, y: 1} - newSize: {x: 1, y: 1} - adaptiveTilingThreshold: 0.5 - drawMode: 0 - adaptiveTiling: 0 - m_AutoTiling: 0 - serializedVersion: 2 - m_Size: {x: 1, y: 1} - m_EdgeRadius: 0 diff --git a/Assets/DevMocks/bman_wall.prefab.meta b/Assets/DevMocks/exitDoorPrefab.prefab.meta similarity index 74% rename from Assets/DevMocks/bman_wall.prefab.meta rename to Assets/DevMocks/exitDoorPrefab.prefab.meta index 3357e82..b98ec03 100644 --- a/Assets/DevMocks/bman_wall.prefab.meta +++ b/Assets/DevMocks/exitDoorPrefab.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: dd25aabed7c6c491eb405f1e5c5f4d99 +guid: 519235375d069406f909265766078ad0 PrefabImporter: externalObjects: {} userData: diff --git a/Assets/DevMocks/old_door.png b/Assets/DevMocks/old_door.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7b159bd13577a7860452d1325c81fe1b671afe GIT binary patch literal 948 zcmV;l155mgP)Px&Zb?KzR9J<@Ry}XqFc5uK35h8h!B)|!Eeg~D0(kS_0tGT==+wU;P)Ct8<;Y&jMfOqBd-v|{QNVv*y-gpSj>Z-JJ~{ij z@q2VfXDztgA#P0zPn2W&ohUV;&*q(b^=QC9nz{ zfCfjd_F^7k_+hIviB1YwvWF@b2a&qg;G)cs22wvW84fy;V5>H#qj5EPKd>^75h?Jn zxi1YQl8~$4g+#)5m%IRUQNRQzsY5`>rVI(=NDFC$=jc?5Rt2V`aWxqZ8rdZ*@R&yc z9(62XT=xN>RAI&Q{=$fSEOsAu!eXH7Elv@MIa3 z9#c}JUTGj(Rj?E=o6l`30zUlm83%iPi}2ys&zSC9S}}S@8mu;^r4pFHfT}Td{=r@! zf73bgbfy6hKJ~FUKT!$nTxvTmScRBJ&$^-}K*mEdo4^#y(;4z~1^}3gg^tmhi-mSY zGA1E2JqbQ%v=p!a^LqYeGyf;&?=Tk&%*6t;n_U3##uT$g&7|b5<7hQu%p>o(rG-So zm6R4py=FJN5Hdr-ROU&^tx~3tY8t}2aoY%(Bz#V$$5EdJO^p7hg#;^mwlU@P*&vtQ zm;r|Q7$nS>yK$GWc`uy-w9-Ny)lB-&25%1tnOWJo`%5ct_DvzA>bIcM96T zh0Kufo_0j$X5&iK_TRmFW6np7kQr|8pYZ1O7SgLny9BrQPa9oV?Oj~`(V!-{`RqT@ W52Dg?_@^cS0000K*T literal 0 HcmV?d00001 diff --git a/Assets/DevMocks/bman_wall.png.meta b/Assets/DevMocks/old_door.png.meta similarity index 96% rename from Assets/DevMocks/bman_wall.png.meta rename to Assets/DevMocks/old_door.png.meta index 8674a7d..c2c003a 100644 --- a/Assets/DevMocks/bman_wall.png.meta +++ b/Assets/DevMocks/old_door.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 96d3693302b284c92ba9c394bb4f72c1 +guid: ac1b266a61f9d43feb33de3a91647f99 TextureImporter: fileIDToRecycleName: {} externalObjects: {} @@ -97,7 +97,7 @@ TextureImporter: outline: [] physicsShape: [] bones: [] - spriteID: 860cb4d89fb584a81bab705ec5b1d21f + spriteID: fa0375da4ccc24a1a804016419fbf262 vertices: [] indices: edges: [] diff --git a/Assets/Prefabs/Managers.meta b/Assets/Prefabs/Managers.meta new file mode 100644 index 0000000..1961c9b --- /dev/null +++ b/Assets/Prefabs/Managers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 56431c4abf09947ed9b3f37ac715caca +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Managers/GameManager.prefab b/Assets/Prefabs/Managers/GameManager.prefab new file mode 100644 index 0000000..a4b6b7d --- /dev/null +++ b/Assets/Prefabs/Managers/GameManager.prefab @@ -0,0 +1,65 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &158905820630581597 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 158905820630581587} + - component: {fileID: 158905820630581586} + - component: {fileID: 158905820630581596} + m_Layer: 0 + m_Name: GameManager + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &158905820630581587 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 158905820630581597} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 7.2735596, y: -6.5702896, z: -10.295408} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &158905820630581586 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 158905820630581597} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 697f5ae5656c74dcd8d7f5d619adb0ac, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!114 &158905820630581596 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 158905820630581597} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 308dfc6b26c3b422faf1717231fc888b, type: 3} + m_Name: + m_EditorClassIdentifier: + boardHolder: {fileID: 0} + startPosition: {fileID: 0} + indestructibleWallPrefab: {fileID: 5996206011854593075, guid: 84b92ac1e96d940bda97d1b1125887d7, + type: 3} + destructibleWallPrefabs: + - {fileID: 4177940729222266681, guid: da559e681f8d34d58bb5f3457045664a, type: 3} + - {fileID: 8729402555587492036, guid: 7e54504f1e1de4334be2e6a115b838c2, type: 3} diff --git a/Assets/Prefabs/Managers/GameManager.prefab.meta b/Assets/Prefabs/Managers/GameManager.prefab.meta new file mode 100644 index 0000000..4b6c023 --- /dev/null +++ b/Assets/Prefabs/Managers/GameManager.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fdaa7451ab31b477b930076bbc888bab +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab b/Assets/Prefabs/Walls/bman_destructible_wall1.prefab index aa9ab03..1bb6453 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab +++ b/Assets/Prefabs/Walls/bman_destructible_wall1.prefab @@ -93,6 +93,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b30e7124fcdf4e1f92fc7dd42d8c7298, type: 3} m_Name: m_EditorClassIdentifier: + explosionPrefab: {fileID: 2086996798441195857, guid: 13213ac562d960e4e8c33d53d40a516c, + type: 3} + exitDoorPrefab: {fileID: 1538214466168189615, guid: 519235375d069406f909265766078ad0, + type: 3} --- !u!1 &5688352134163068791 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab b/Assets/Prefabs/Walls/bman_destructible_wall2.prefab index 0e1d1d4..97254da 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab +++ b/Assets/Prefabs/Walls/bman_destructible_wall2.prefab @@ -172,3 +172,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b30e7124fcdf4e1f92fc7dd42d8c7298, type: 3} m_Name: m_EditorClassIdentifier: + explosionPrefab: {fileID: 2086996798441195857, guid: 13213ac562d960e4e8c33d53d40a516c, + type: 3} + exitDoorPrefab: {fileID: 1538214466168189615, guid: 519235375d069406f909265766078ad0, + type: 3} diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index fb65d37..16829bd 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -8206,69 +8206,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &840487110 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 840487112} - - component: {fileID: 840487113} - - component: {fileID: 840487111} - m_Layer: 0 - m_Name: GameManager - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &840487111 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 840487110} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 308dfc6b26c3b422faf1717231fc888b, type: 3} - m_Name: - m_EditorClassIdentifier: - boardHolder: {fileID: 585332173} - startPosition: {fileID: 185746015} - indestructibleWallPrefab: {fileID: 5996206011854593075, guid: 84b92ac1e96d940bda97d1b1125887d7, - type: 3} - destructibleWallPrefabs: - - {fileID: 4177940729222266681, guid: da559e681f8d34d58bb5f3457045664a, type: 3} - - {fileID: 8729402555587492036, guid: 7e54504f1e1de4334be2e6a115b838c2, type: 3} ---- !u!4 &840487112 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 840487110} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 7.2735596, y: -6.5702896, z: -10.295408} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 6 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &840487113 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 840487110} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 697f5ae5656c74dcd8d7f5d619adb0ac, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &1135949884 GameObject: m_ObjectHideFlags: 0 @@ -8408,6 +8345,85 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: c9b7903151183144dbf30c9b2ab371b2, type: 3} +--- !u!1001 &158905819792232859 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 158905820630581597, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_Name + value: GameManager + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalPosition.x + value: 7.2735596 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalPosition.y + value: -6.5702896 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalPosition.z + value: -10.295408 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_RootOrder + value: 6 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581587, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 158905820630581596, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: boardHolder + value: + objectReference: {fileID: 585332173} + - target: {fileID: 158905820630581596, guid: fdaa7451ab31b477b930076bbc888bab, + type: 3} + propertyPath: startPosition + value: + objectReference: {fileID: 185746015} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: fdaa7451ab31b477b930076bbc888bab, type: 3} --- !u!1001 &6843575829779162303 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/src/Wall/DestructibleWall.cs b/Assets/Scripts/src/Wall/DestructibleWall.cs index 0422379..fc3dfe0 100644 --- a/Assets/Scripts/src/Wall/DestructibleWall.cs +++ b/Assets/Scripts/src/Wall/DestructibleWall.cs @@ -8,6 +8,8 @@ namespace src.Wall { private bool _spawnExit; private bool _spawnUpgrade; + public GameObject explosionPrefab; + public GameObject exitDoorPrefab; public void SpawnsExit() { @@ -22,22 +24,28 @@ namespace src.Wall public float XCoordinate => transform.position.x; public float YCoordinate => transform.position.y; - public void OnDestroy() + private void BeforeDestroy() { + var currentPosition = transform.position; + Destroy(GetComponent()); + Instantiate(explosionPrefab, currentPosition, Quaternion.identity); if (_spawnExit) { - // TODO Spawn an exit + Debug.Log($"Destructible spawned exit {transform.position}"); + Instantiate(exitDoorPrefab, currentPosition, Quaternion.identity); } else if (_spawnUpgrade) { - // TODO Spawn an upgrade, use composition to UpgradeManager - // to get random / desired upgrade + Debug.Log($"Destructible spawned upgrade {transform.position}"); + // TODO: Get and instantiate upgrade from manager } } public void onExplosion() { - Debug.Log("Destructible wall hitted by explosion"); + Debug.Log($"Destructible wall hit by explosion {transform.position}"); + BeforeDestroy(); + Destroy(gameObject); } } } \ No newline at end of file