From fc39fd726bb5715136b3316b2f3c20e1ed9b3e2d Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 21 Apr 2018 16:13:59 +0200 Subject: [PATCH] Room fix --- Assets/Prefabs/StartingRoom.prefab | 6 ++++-- Assets/Scripts/Room.cs | 21 +++++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Assets/Prefabs/StartingRoom.prefab b/Assets/Prefabs/StartingRoom.prefab index 6bbdb86..a04b7f9 100644 --- a/Assets/Prefabs/StartingRoom.prefab +++ b/Assets/Prefabs/StartingRoom.prefab @@ -71,8 +71,8 @@ GameObject: serializedVersion: 5 m_Component: - component: {fileID: 4576663487368228} - - component: {fileID: 61347333512881174} - component: {fileID: 114777089437464196} + - component: {fileID: 61347333512881174} m_Layer: 0 m_Name: UpperDoor m_TagString: Untagged @@ -282,7 +282,7 @@ BoxCollider2D: m_Density: 1 m_Material: {fileID: 0} m_IsTrigger: 0 - m_UsedByEffector: 0 + m_UsedByEffector: 1 m_UsedByComposite: 0 m_Offset: {x: -0.63960123, y: -7.9419603} m_SpriteTilingProperty: @@ -396,6 +396,8 @@ MonoBehaviour: m_EditorClassIdentifier: Width: 0 Height: 0 + doorsRootObject: {fileID: 1394898907781064} + objective: {fileID: 0} --- !u!212 &212881422167649272 SpriteRenderer: m_ObjectHideFlags: 1 diff --git a/Assets/Scripts/Room.cs b/Assets/Scripts/Room.cs index 6ab2c12..6451e1d 100644 --- a/Assets/Scripts/Room.cs +++ b/Assets/Scripts/Room.cs @@ -6,11 +6,16 @@ public class Room : MonoBehaviour { [SerializeField] int Width, Height; // Gridsize for Generation + List doors; + List spawnpoints; [SerializeField] GameObject doorsRootObject; + [SerializeField] + GameObject spawnpointRootObject; + [SerializeField] private Objective objective; @@ -21,10 +26,15 @@ public class Room : MonoBehaviour { { doors.Add(d); } - } + spawnpoints = new List(); + foreach (Transform t in spawnpointRootObject.GetComponentsInChildren()) + { + spawnpoints.Add(t); + } + } - void Lock() + public void Lock() { foreach (Door d in doors) { @@ -32,7 +42,7 @@ public class Room : MonoBehaviour { } } - void Unlock() + public void Unlock() { foreach (Door d in doors) { @@ -40,5 +50,8 @@ public class Room : MonoBehaviour { } } - + public List GetSpawnpoints() + { + return spawnpoints; + } }