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 - - -