private void FixedUpdate() { int x, y; if (daRocks.warn(closer.warnCheck(out x, out y), x, y)) { float lx = startX + x * xTileSize + xOffset - xTileSize / 2; float hx = startX + x * xTileSize + xOffset + xTileSize / 2; float ly = startY + y * yTileSize + yOffset - yTileSize / 2; float hy = startY + y * yTileSize + yOffset + yTileSize / 2; //print("CLOSE ROOM " + x + " " + y + " " + hx + " " + lx + " " + hy + " " + ly); //if the player is within the bounds of the room, DIE foreach (Transform child in PlayerArray.transform) { if (child.position.x > lx && child.position.x < hx && child.position.y > ly && child.position.y < hy) { child.GetComponent <PlayerHealth>().PlayerDeath(); } } //close all doors in the room doorManager.CloseDownRoom(x, y); } }