From 61e9b3712aaf72e273c460a8c588f4419684360e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Tue, 11 Jun 2019 19:28:42 +0300 Subject: [PATCH 1/5] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8076a78..9036222 100644 --- a/.gitignore +++ b/.gitignore @@ -534,7 +534,7 @@ MigrationBackup/ ![Aa]ssets/**/*.meta # Ignore editor plugins -Assets/Plugins/Editor/* +Assets/Plugins/Editor* [Aa]ssets/Plugins/Editor/JetBrains/* # End of https://www.gitignore.io/api/unity,rider,jetbrains,visualstudio,visualstudiocode \ No newline at end of file From a80f36e33f7bbe22c17745c40d7818c16dd72ec0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Tue, 11 Jun 2019 19:33:16 +0300 Subject: [PATCH 2/5] Add wall/floor material to RigidBodies --- Assets/Prefabs/Walls/bman_destructible_wall1.prefab | 2 +- Assets/Prefabs/Walls/bman_destructible_wall2.prefab | 2 +- Assets/Prefabs/Walls/bman_indestructible_wall1.prefab | 2 +- Assets/Scenes/SampleScene.unity | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab b/Assets/Prefabs/Walls/bman_destructible_wall1.prefab index 529e726..aa9ab03 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab +++ b/Assets/Prefabs/Walls/bman_destructible_wall1.prefab @@ -50,7 +50,7 @@ Rigidbody2D: m_LinearDrag: 0 m_AngularDrag: 0.05 m_GravityScale: 1 - m_Material: {fileID: 0} + m_Material: {fileID: 6200000, guid: dc8eb6133faaf45f6820487d0d28b47f, type: 2} m_Interpolate: 0 m_SleepingMode: 1 m_CollisionDetection: 0 diff --git a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab b/Assets/Prefabs/Walls/bman_destructible_wall2.prefab index 8b1c9fa..0e1d1d4 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab +++ b/Assets/Prefabs/Walls/bman_destructible_wall2.prefab @@ -129,7 +129,7 @@ Rigidbody2D: m_LinearDrag: 0 m_AngularDrag: 0.05 m_GravityScale: 1 - m_Material: {fileID: 0} + m_Material: {fileID: 6200000, guid: dc8eb6133faaf45f6820487d0d28b47f, type: 2} m_Interpolate: 0 m_SleepingMode: 1 m_CollisionDetection: 0 diff --git a/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab b/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab index 35bc431..e44453b 100644 --- a/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab +++ b/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab @@ -49,7 +49,7 @@ Rigidbody2D: m_LinearDrag: 0 m_AngularDrag: 0.05 m_GravityScale: 1 - m_Material: {fileID: 0} + m_Material: {fileID: 6200000, guid: dc8eb6133faaf45f6820487d0d28b47f, type: 2} m_Interpolate: 0 m_SleepingMode: 1 m_CollisionDetection: 0 diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index a5e96cb..fb65d37 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -7781,7 +7781,7 @@ CompositeCollider2D: m_GameObject: {fileID: 69346940} m_Enabled: 1 m_Density: 1 - m_Material: {fileID: 6200000, guid: dc8eb6133faaf45f6820487d0d28b47f, type: 2} + m_Material: {fileID: 0} m_IsTrigger: 0 m_UsedByEffector: 0 m_UsedByComposite: 0 @@ -7835,7 +7835,7 @@ Rigidbody2D: m_LinearDrag: 0 m_AngularDrag: 0.05 m_GravityScale: 1 - m_Material: {fileID: 0} + m_Material: {fileID: 6200000, guid: 09a32766a59c24bef94b71414d0ccda5, type: 2} m_Interpolate: 0 m_SleepingMode: 1 m_CollisionDetection: 0 @@ -8156,7 +8156,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519420028} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 7.7645655, y: -4.0430503, z: -2.7893844} + m_LocalPosition: {x: 10.581639, y: -4.0430503, z: -2.7893844} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} 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 3/5] 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 From 9d544f7687d922a7f5bd769af6dd397b87f6c915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Tue, 11 Jun 2019 20:10:16 +0300 Subject: [PATCH 4/5] Implement DebugHelper class --- Assets/Scripts/src/Helpers/DebugHelper.cs | 59 +++++++++++++++++++ .../Scripts/src/Helpers/DebugHelper.cs.meta | 3 + 2 files changed, 62 insertions(+) create mode 100644 Assets/Scripts/src/Helpers/DebugHelper.cs create mode 100644 Assets/Scripts/src/Helpers/DebugHelper.cs.meta diff --git a/Assets/Scripts/src/Helpers/DebugHelper.cs b/Assets/Scripts/src/Helpers/DebugHelper.cs new file mode 100644 index 0000000..d23b438 --- /dev/null +++ b/Assets/Scripts/src/Helpers/DebugHelper.cs @@ -0,0 +1,59 @@ +using System; +using UnityEngine; +// ReSharper disable UnusedMember.Global +// ReSharper disable UnusedMember.Local +// ReSharper disable ArrangeTypeMemberModifiers + +namespace src.Helpers +{ + public static class DebugHelper + { + public static void LogInfo(string message) + { + if (Debug.isDebugBuild) + { + Debug.Log(message); + } + } + + public static void LogWarning(string message) + { + if (Debug.isDebugBuild) + { + Debug.LogWarning(message); + } + } + + public static void LogError(string message) + { + if (Debug.isDebugBuild) + { + Debug.LogError(message); + } + } + + public static void LogException(Exception ex) + { + if (Debug.isDebugBuild) + { + Debug.LogException(ex); + } + } + + public static void DrawRay(Vector3 position, Vector3 direction, Color color) + { + if (Debug.isDebugBuild) + { + Debug.DrawRay(position, direction, color); + } + } + + public static void DrawLine(Vector3 position, Vector3 direction, Color color) + { + if (Debug.isDebugBuild) + { + Debug.DrawLine(position, direction, color); + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/src/Helpers/DebugHelper.cs.meta b/Assets/Scripts/src/Helpers/DebugHelper.cs.meta new file mode 100644 index 0000000..653b2f7 --- /dev/null +++ b/Assets/Scripts/src/Helpers/DebugHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 36a93a2c984d44bd8d65a9a3ad28894e +timeCreated: 1560272684 \ No newline at end of file From 1c55c754e1b6316500916572dad1a199ecfdd14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nu=C8=9Biu?= Date: Tue, 11 Jun 2019 21:47:37 +0300 Subject: [PATCH 5/5] Implement transparent walls when player is near --- Assets/Prefabs/Player.prefab | 4 +- .../Walls/bman_destructible_wall1.prefab | 13 ++++ .../Walls/bman_destructible_wall2.prefab | 13 ++++ .../Walls/bman_indestructible_wall1.prefab | 13 ++++ Assets/Scenes/SampleScene.unity | 16 ++--- Assets/Scripts/src/Wall/WallTransparency.cs | 65 +++++++++++++++++++ .../Scripts/src/Wall/WallTransparency.cs.meta | 3 + ProjectSettings/Physics2DSettings.asset | 2 +- ProjectSettings/TagManager.asset | 2 +- 9 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 Assets/Scripts/src/Wall/WallTransparency.cs create mode 100644 Assets/Scripts/src/Wall/WallTransparency.cs.meta diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 5db1f5f..f8fbbe4 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -71,7 +71,7 @@ SpriteRenderer: m_LightmapParameters: {fileID: 0} m_SortingLayerID: 0 m_SortingLayer: 0 - m_SortingOrder: 1 + m_SortingOrder: 0 m_Sprite: {fileID: 21300000, guid: 69237087e6b0b42ac8d25d0035b2e01b, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 @@ -97,8 +97,6 @@ MonoBehaviour: m_EditorClassIdentifier: movementSpeed: 4 respawnPosition: {fileID: 0} - bombPrefab: {fileID: 5909392949477884267, guid: 28467e0d65b5d3844bf1862ac0c49ad9, - type: 3} --- !u!50 &6843575828445418653 Rigidbody2D: serializedVersion: 4 diff --git a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab b/Assets/Prefabs/Walls/bman_destructible_wall1.prefab index 1bb6453..0a8544a 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall1.prefab +++ b/Assets/Prefabs/Walls/bman_destructible_wall1.prefab @@ -12,6 +12,7 @@ GameObject: - component: {fileID: 4177940729222266823} - component: {fileID: 4177940729222266822} - component: {fileID: 2823577682722293689} + - component: {fileID: 4525879622828546227} m_Layer: 8 m_Name: bman_destructible_wall1 m_TagString: Untagged @@ -97,6 +98,18 @@ MonoBehaviour: type: 3} exitDoorPrefab: {fileID: 1538214466168189615, guid: 519235375d069406f909265766078ad0, type: 3} +--- !u!114 &4525879622828546227 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4177940729222266681} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f76d22fdcb894023bd111d6b5bc1da5e, type: 3} + m_Name: + m_EditorClassIdentifier: --- !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 97254da..41c4aa2 100644 --- a/Assets/Prefabs/Walls/bman_destructible_wall2.prefab +++ b/Assets/Prefabs/Walls/bman_destructible_wall2.prefab @@ -91,6 +91,7 @@ GameObject: - component: {fileID: 8360026854687715433} - component: {fileID: 1860172021824364478} - component: {fileID: 3937551180478767488} + - component: {fileID: 2850266447828806432} m_Layer: 8 m_Name: bman_destructible_wall2 m_TagString: Untagged @@ -176,3 +177,15 @@ MonoBehaviour: type: 3} exitDoorPrefab: {fileID: 1538214466168189615, guid: 519235375d069406f909265766078ad0, type: 3} +--- !u!114 &2850266447828806432 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8729402555587492036} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f76d22fdcb894023bd111d6b5bc1da5e, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab b/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab index e44453b..ae3649a 100644 --- a/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab +++ b/Assets/Prefabs/Walls/bman_indestructible_wall1.prefab @@ -11,6 +11,7 @@ GameObject: - component: {fileID: 3400997238130971262} - component: {fileID: 3305047832243218078} - component: {fileID: 7808374684255412738} + - component: {fileID: 9150705305556807559} m_Layer: 8 m_Name: bman_indestructible_wall1 m_TagString: Untagged @@ -80,6 +81,18 @@ BoxCollider2D: serializedVersion: 2 m_Size: {x: 1, y: 1} m_EdgeRadius: 0 +--- !u!114 &9150705305556807559 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5996206011854593075} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f76d22fdcb894023bd111d6b5bc1da5e, type: 3} + m_Name: + m_EditorClassIdentifier: --- !u!1 &6716060611887421146 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 16829bd..0ffd5e0 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -8018,7 +8018,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 266944714} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: -2.7893844} + m_LocalPosition: {x: 0, y: 0, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 97386695} @@ -8156,7 +8156,7 @@ Transform: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 519420028} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 10.581639, y: -4.0430503, z: -2.7893844} + m_LocalPosition: {x: 10.590895, y: -4.0430503, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} @@ -8436,6 +8436,11 @@ PrefabInstance: propertyPath: m_Name value: Player objectReference: {fileID: 0} + - target: {fileID: 6843575828445418657, guid: d3055091a17dc4aa1accf2e33ccef144, + type: 3} + propertyPath: m_Layer + value: 15 + objectReference: {fileID: 0} - target: {fileID: 6843575828445418654, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} propertyPath: m_LocalPosition.x @@ -8449,7 +8454,7 @@ PrefabInstance: - target: {fileID: 6843575828445418654, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} propertyPath: m_LocalPosition.z - value: 7.2106156 + value: 0 objectReference: {fileID: 0} - target: {fileID: 6843575828445418654, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} @@ -8496,10 +8501,5 @@ PrefabInstance: propertyPath: respawnPosition value: objectReference: {fileID: 185746015} - - target: {fileID: 6843575828445418655, guid: d3055091a17dc4aa1accf2e33ccef144, - type: 3} - propertyPath: m_SortingOrder - value: 0 - objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d3055091a17dc4aa1accf2e33ccef144, type: 3} diff --git a/Assets/Scripts/src/Wall/WallTransparency.cs b/Assets/Scripts/src/Wall/WallTransparency.cs new file mode 100644 index 0000000..7522112 --- /dev/null +++ b/Assets/Scripts/src/Wall/WallTransparency.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using src.Base; +using src.Helpers; +using UnityEngine; + +namespace src.Wall +{ + public class WallTransparency : GameplayComponent + { + private SpriteRenderer _spriteRenderer; + private Color _originalSpriteColor; + private bool _isTransparent; + + private void Start() + { + _spriteRenderer = GetComponentInChildren(); + _originalSpriteColor = _spriteRenderer.color; + } + + private void Update() + { + var position = transform.position; + /* RayCast from the center of the tile up one distance and set layerMask to Player only! */ + var hit = Physics2D.Raycast(new Vector2(position.x + .5f, position.y + 0.5f), + Vector2.up, 1f, 1 << 15); + if (hit.collider) + { + BecomeTransparent(); + } + else + { + BecomeOpaque(); + } + } + + private void ChangeSpriteAlpha(float alpha) + { + _spriteRenderer.color = + new Color(_originalSpriteColor.r, _originalSpriteColor.g, _originalSpriteColor.b, alpha); + } + + private void BecomeTransparent() + { + if (_isTransparent) + { + return; + } + + _isTransparent = true; + ChangeSpriteAlpha(0.5f); + } + + private void BecomeOpaque() + { + if (!_isTransparent) + { + return; + } + + _isTransparent = false; + ChangeSpriteAlpha(1f); + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/src/Wall/WallTransparency.cs.meta b/Assets/Scripts/src/Wall/WallTransparency.cs.meta new file mode 100644 index 0000000..c84e78e --- /dev/null +++ b/Assets/Scripts/src/Wall/WallTransparency.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f76d22fdcb894023bd111d6b5bc1da5e +timeCreated: 1560273099 \ No newline at end of file diff --git a/ProjectSettings/Physics2DSettings.asset b/ProjectSettings/Physics2DSettings.asset index cecfb1f..30eede9 100644 --- a/ProjectSettings/Physics2DSettings.asset +++ b/ProjectSettings/Physics2DSettings.asset @@ -53,4 +53,4 @@ Physics2DSettings: m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} - m_LayerCollisionMatrix: fffbfffffffbfffffffbfffffffffffffffbfffffffbfffffffffffffffffffffffbffffffffffffc8faffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff + m_LayerCollisionMatrix: fffbffffff7bffffff7bffffffffffffff7bfffffffbfffffffffffffffffffffffbffffffffffffc87affffffffffffffffffffffffffffffffffffe9fbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff diff --git a/ProjectSettings/TagManager.asset b/ProjectSettings/TagManager.asset index 4d4eaab..c1f14aa 100644 --- a/ProjectSettings/TagManager.asset +++ b/ProjectSettings/TagManager.asset @@ -22,7 +22,7 @@ TagManager: - - - - - + - Player - - -