From dbc713b6c49a08ee163f6675c51d224685af99c5 Mon Sep 17 00:00:00 2001 From: Piegames <14054505+piegamesde@users.noreply.github.com> Date: Mon, 23 Apr 2018 17:21:41 +0200 Subject: [PATCH] Closing rooms works now --- Assets/Scripts/Door.cs | 8 +++++--- Assets/Scripts/GameController.cs | 7 +++++-- Assets/graphics/textures/car.meta | 8 ++++++++ Assets/graphics/textures/tmp.meta | 8 ++++++++ 4 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 Assets/graphics/textures/car.meta create mode 100644 Assets/graphics/textures/tmp.meta diff --git a/Assets/Scripts/Door.cs b/Assets/Scripts/Door.cs index a47cee7..65e5489 100644 --- a/Assets/Scripts/Door.cs +++ b/Assets/Scripts/Door.cs @@ -30,7 +30,7 @@ public class Door : MonoBehaviour { public void SetParent(Room room) { this.parent = room; } - + /// /// Locks the door. /// @@ -65,13 +65,15 @@ public class Door : MonoBehaviour { /// private void OnTriggerExit2D(Collider2D collision) { if ( collision.tag == "Player") { - // TODO better checks + Player player = collision.gameObject.GetComponent(); + if ((boundingBox.offset - parent.GetCenter()).sqrMagnitude < ((Vector2) player.transform.position - parent.GetCenter()).sqrMagnitude) + return; Debug.Log("Leaving Trigger"); if(parent == null) { Debug.Log("This door has no parent Room!"); return; } - parent.OnPlayerEnter(collision.gameObject.GetComponent()); + parent.OnPlayerEnter(player); } } } diff --git a/Assets/Scripts/GameController.cs b/Assets/Scripts/GameController.cs index 8caa4bd..f125a51 100644 --- a/Assets/Scripts/GameController.cs +++ b/Assets/Scripts/GameController.cs @@ -122,8 +122,11 @@ public class GameController : MonoBehaviour { { GenerationProcessor.ExtendedTileType.RockLUD, RockLUD }, { GenerationProcessor.ExtendedTileType.RockLUR, RockLUR }, { GenerationProcessor.ExtendedTileType.RockURD, RockURD }, - { GenerationProcessor.ExtendedTileType.RockLRD, RockLRD }, - { GenerationProcessor.ExtendedTileType.Ground, Ground }, + { GenerationProcessor.ExtendedTileType.RockLRD, RockLRD }, + { GenerationProcessor.ExtendedTileType.Ground0, Ground0 }, + { GenerationProcessor.ExtendedTileType.Ground1, Ground1 }, + { GenerationProcessor.ExtendedTileType.Ground2, Ground2 }, + { GenerationProcessor.ExtendedTileType.Ground3, Ground3 }, { GenerationProcessor.ExtendedTileType.DoorInner, DoorInner }, { GenerationProcessor.ExtendedTileType.DoorOuter, DoorOuter } }; diff --git a/Assets/graphics/textures/car.meta b/Assets/graphics/textures/car.meta new file mode 100644 index 0000000..8504594 --- /dev/null +++ b/Assets/graphics/textures/car.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9ec323b9157704d00a3409f8ea6e46b2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/graphics/textures/tmp.meta b/Assets/graphics/textures/tmp.meta new file mode 100644 index 0000000..7ebab68 --- /dev/null +++ b/Assets/graphics/textures/tmp.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: df6e7833427b5497b92308fb6f54e552 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: