From 7131edce749368fead16ac23ffc873ed1e63a450 Mon Sep 17 00:00:00 2001 From: milan Date: Sun, 13 Nov 2022 20:26:51 +0100 Subject: [PATCH] move space tiles into parent for readability --- Assets/Escape Room Engine/Engine/Prefabs/Space Tile.prefab | 2 +- Assets/Escape Room Engine/Engine/Scripts/Space.cs | 7 +++++-- Assets/Escape Room Engine/Engine/Scripts/SpaceTile.cs | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Space Tile.prefab b/Assets/Escape Room Engine/Engine/Prefabs/Space Tile.prefab index 48f304d..e0c67b5 100644 --- a/Assets/Escape Room Engine/Engine/Prefabs/Space Tile.prefab +++ b/Assets/Escape Room Engine/Engine/Prefabs/Space Tile.prefab @@ -15,7 +15,7 @@ GameObject: m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 + m_StaticEditorFlags: 2147483647 m_IsActive: 1 --- !u!4 &8664788757336834019 Transform: diff --git a/Assets/Escape Room Engine/Engine/Scripts/Space.cs b/Assets/Escape Room Engine/Engine/Scripts/Space.cs index 5d23da1..60be555 100644 --- a/Assets/Escape Room Engine/Engine/Scripts/Space.cs +++ b/Assets/Escape Room Engine/Engine/Scripts/Space.cs @@ -16,7 +16,7 @@ namespace Escape_Room_Engine.Engine.Scripts internal readonly Dimensions rrDimensions; internal List Modules { get; } = new(2); - private GameObject _spaceObject; + private GameObject _spaceObject, _spaceTiles; private readonly Room _room; internal Space(Room room, Passage entrance) @@ -64,6 +64,9 @@ namespace Escape_Room_Engine.Engine.Scripts _spaceObject.transform.localPosition = new Vector3(rrDimensions.x, 0, rrDimensions.z); // build the space floor out of tiles + _spaceTiles = new GameObject($"Space Geometry"); + _spaceTiles.transform.SetParent(_spaceObject.transform, false); + _spaceTiles.isStatic = true; for (var z = 0; z < rrDimensions.length; z++) { for (var x = 0; x < rrDimensions.width; x++) @@ -81,7 +84,7 @@ namespace Escape_Room_Engine.Engine.Scripts else location = left ? TileLocation.W : right ? TileLocation.E : TileLocation.C; - var tileObject = Object.Instantiate(Engine.DefaultEngine.config.spaceTile, _spaceObject.transform, false); + var tileObject = Object.Instantiate(Engine.DefaultEngine.config.spaceTile, _spaceTiles.transform, false); tileObject.transform.localPosition = new Vector3(x, 0, z); tileObject.showTile = location; } diff --git a/Assets/Escape Room Engine/Engine/Scripts/SpaceTile.cs b/Assets/Escape Room Engine/Engine/Scripts/SpaceTile.cs index 29a8db2..7a886c8 100644 --- a/Assets/Escape Room Engine/Engine/Scripts/SpaceTile.cs +++ b/Assets/Escape Room Engine/Engine/Scripts/SpaceTile.cs @@ -54,6 +54,7 @@ namespace Escape_Room_Engine.Engine.Scripts } _tile = Instantiate(tilePrefabs[showTile], transform); + _tile.isStatic = true; _tile.GetComponent().material = material; _showTile = showTile;