diff --git a/MrBigsock/Assets/Code/InteractionSystem/Door.cs b/MrBigsock/Assets/Code/InteractionSystem/Door.cs index caa1b80e84403c5323240ac951b47d1515e6ab15..d90a8a7f49ba39a438a01294923b878ba024ba07 100644 --- a/MrBigsock/Assets/Code/InteractionSystem/Door.cs +++ b/MrBigsock/Assets/Code/InteractionSystem/Door.cs @@ -11,14 +11,15 @@ namespace BigSock.Interact { public Sprite newSprite; private GameObject[] enemies; private GameObject player; - private GameObject cameraPlayer; - private int i = TilemapGenerator.NextRoom(); - private GameObject boundary; + private GameObject cameraPlayer; + private int i = TilemapGenerator.NextRoom(); + private GameObject boundary; - public string InteractionPrompt => _prompt; + public string InteractionPrompt => _prompt; - public bool Interact(Interactor interactor) { - enemies = GameObject.FindGameObjectsWithTag((i - 1).ToString()); + public bool Interact(Interactor interactor) { + if(i > 0)enemies = GameObject.FindGameObjectsWithTag((i - 1).ToString()); + else if (i > 0) enemies = GameObject.FindGameObjectsWithTag((0).ToString()); if (enemies.Length == 0) { Debug.Log("Opening door!");