From d36d33ca96161e0c8439ff463a40a4fee166ac0d Mon Sep 17 00:00:00 2001 From: milan Date: Wed, 7 Dec 2022 15:41:00 +0100 Subject: [PATCH] correctly delete old rooms --- Assets/Desert/Assets/Desert Spawn.asset | 2 +- Assets/Desert/Assets/Desert.asset | 4 +- .../Portal/Desert Portal Entrance.asset | 3 +- .../Portal/Desert Portal Entrance.prefab | 39 +++--- .../Modules/Portal/Desert Portal Exit.asset | 3 +- .../Modules/Portal/Desert Portal Exit.prefab | 25 +++- .../Assets/Prefabs/Desert Environment.prefab | 114 ++++++++---------- .../Assets/Prefabs/Desert Floor Tile.prefab | 114 ------------------ .../Prefabs/Desert Floor Tile.prefab.meta | 7 -- Assets/Desert/Runtime/Desert.asmdef | 1 + Assets/Desert/Runtime/Portal.meta | 3 + Assets/Desert/Runtime/Portal/DesertPortal.cs | 34 ++++++ .../Runtime/Portal/DesertPortal.cs.meta | 3 + .../Assets/Module Descriptions/Spawn.asset | 2 +- Assets/Engine/Runtime/Engine.cs | 20 ++- Assets/Engine/Runtime/Modules/DoorState.cs | 2 +- Assets/Engine/Runtime/Room.cs | 33 +++-- .../Runtime/Utilities/DisablePicking.cs | 17 +++ .../Runtime/Utilities/DisablePicking.cs.meta | 3 + Assets/Portal/Runtime/Portal.cs | 20 ++- Assets/Portal/Runtime/PortalDriver.cs | 8 +- Assets/Portal/Runtime/PortalDriverClone.cs | 5 + Assets/Scenes/TestScene.unity | 2 +- 23 files changed, 222 insertions(+), 242 deletions(-) delete mode 100644 Assets/Desert/Assets/Prefabs/Desert Floor Tile.prefab delete mode 100644 Assets/Desert/Assets/Prefabs/Desert Floor Tile.prefab.meta create mode 100644 Assets/Desert/Runtime/Portal.meta create mode 100644 Assets/Desert/Runtime/Portal/DesertPortal.cs create mode 100644 Assets/Desert/Runtime/Portal/DesertPortal.cs.meta create mode 100644 Assets/Engine/Runtime/Utilities/DisablePicking.cs create mode 100644 Assets/Engine/Runtime/Utilities/DisablePicking.cs.meta diff --git a/Assets/Desert/Assets/Desert Spawn.asset b/Assets/Desert/Assets/Desert Spawn.asset index e019fb9..608728a 100644 --- a/Assets/Desert/Assets/Desert Spawn.asset +++ b/Assets/Desert/Assets/Desert Spawn.asset @@ -13,7 +13,7 @@ MonoBehaviour: m_Name: Desert Spawn m_EditorClassIdentifier: types: 00000000 - modulePrefab: {fileID: 2398776566740968028, guid: 0f52b7f0ec633bc4d8bc73cfbef29bf9, + modulePrefab: {fileID: 1834615596445353898, guid: 0f52b7f0ec633bc4d8bc73cfbef29bf9, type: 3} preconditionRequirements: [] placementRequirements: diff --git a/Assets/Desert/Assets/Desert.asset b/Assets/Desert/Assets/Desert.asset index e45e82d..1021a7c 100644 --- a/Assets/Desert/Assets/Desert.asset +++ b/Assets/Desert/Assets/Desert.asset @@ -12,8 +12,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 28d04249c1c4438da94b524e7d4afff2, type: 3} m_Name: Desert m_EditorClassIdentifier: - minRoomSize: {x: 2, y: 3} - playSpace: {x: 2, y: 4} + minRoomSize: {x: 4, y: 2} + playSpace: {x: 4, y: 2} spaceTile: {fileID: 3229991053255736984, guid: b8f192f7cebe686468af6b1a71c4605b, type: 3} environment: {fileID: 5743657079028767629, guid: 17ecdbaca50efaa4ab503614dfec54a8, diff --git a/Assets/Desert/Assets/Modules/Portal/Desert Portal Entrance.asset b/Assets/Desert/Assets/Modules/Portal/Desert Portal Entrance.asset index 8e99466..907d8a5 100644 --- a/Assets/Desert/Assets/Modules/Portal/Desert Portal Entrance.asset +++ b/Assets/Desert/Assets/Modules/Portal/Desert Portal Entrance.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Desert Portal Entrance m_EditorClassIdentifier: types: 00000000 - modulePrefab: {fileID: 1249363658, guid: 0f721fa68edd220438bc7bbbe6ede885, type: 3} + modulePrefab: {fileID: 3392592227672293041, guid: 0f721fa68edd220438bc7bbbe6ede885, + type: 3} preconditionRequirements: [] placementRequirements: - {fileID: 11400000, guid: 43eb2a566a244964aa3a3319eaafe1a8, type: 2} diff --git a/Assets/Desert/Assets/Modules/Portal/Desert Portal Entrance.prefab b/Assets/Desert/Assets/Modules/Portal/Desert Portal Entrance.prefab index 195e703..ff6ee8e 100644 --- a/Assets/Desert/Assets/Modules/Portal/Desert Portal Entrance.prefab +++ b/Assets/Desert/Assets/Modules/Portal/Desert Portal Entrance.prefab @@ -59,7 +59,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: bcd51a92199746578f25ab67160cc13d, type: 3} m_Name: m_EditorClassIdentifier: - portal: {fileID: 1249363658} + portal: {fileID: 3392592227672293041} --- !u!1 &2892577287002708294 GameObject: m_ObjectHideFlags: 0 @@ -101,8 +101,8 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 2246995198243242195} - - component: {fileID: 1249363658} - - component: {fileID: 7604291350124895408} + - component: {fileID: 4730225679938238730} + - component: {fileID: 3392592227672293041} m_Layer: 7 m_Name: Desert Portal Entrance m_TagString: Untagged @@ -126,7 +126,7 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1249363658 +--- !u!114 &4730225679938238730 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -135,26 +135,27 @@ MonoBehaviour: m_GameObject: {fileID: 5635962022185625128} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ae59cddbf8fa37549bb38b1039feeb34, type: 3} + m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3} + m_Name: + m_EditorClassIdentifier: + color: {r: 8, g: 3.5137255, b: 0, a: 1} + emissionRenderer: {fileID: 4905517471767474057} +--- !u!114 &3392592227672293041 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5635962022185625128} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 20837d5efd544d3eb07657f581cb76d2, type: 3} m_Name: m_EditorClassIdentifier: size: {x: 2, y: 1} linkedPortal: {fileID: 0} portalCamera: {fileID: 17691322601746172} portalTransform: {fileID: 2075043192862140148} ---- !u!65 &7604291350124895408 -BoxCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 5635962022185625128} - m_Material: {fileID: 0} - m_IsTrigger: 1 - m_Enabled: 1 - serializedVersion: 2 - m_Size: {x: 1, y: 2.05, z: 0.3} - m_Center: {x: 0.5, y: 1.025, z: 0.25} --- !u!1 &6999744959693749346 GameObject: m_ObjectHideFlags: 0 @@ -396,7 +397,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: minNearClipPlane: 0.0001 - portal: {fileID: 1249363658} + portal: {fileID: 3392592227672293041} screen: {fileID: 6419237152131296747} --- !u!1 &8849014083961458004 GameObject: diff --git a/Assets/Desert/Assets/Modules/Portal/Desert Portal Exit.asset b/Assets/Desert/Assets/Modules/Portal/Desert Portal Exit.asset index 6da6ce5..565d375 100644 --- a/Assets/Desert/Assets/Modules/Portal/Desert Portal Exit.asset +++ b/Assets/Desert/Assets/Modules/Portal/Desert Portal Exit.asset @@ -13,7 +13,8 @@ MonoBehaviour: m_Name: Desert Portal Exit m_EditorClassIdentifier: types: 01000000 - modulePrefab: {fileID: 1249363658, guid: 07cea580d9888d24c84d8d62747839ad, type: 3} + modulePrefab: {fileID: 3171802695548060926, guid: 07cea580d9888d24c84d8d62747839ad, + type: 3} preconditionRequirements: [] placementRequirements: - {fileID: 11400000, guid: 43eb2a566a244964aa3a3319eaafe1a8, type: 2} diff --git a/Assets/Desert/Assets/Modules/Portal/Desert Portal Exit.prefab b/Assets/Desert/Assets/Modules/Portal/Desert Portal Exit.prefab index be1dec5..57db3be 100644 --- a/Assets/Desert/Assets/Modules/Portal/Desert Portal Exit.prefab +++ b/Assets/Desert/Assets/Modules/Portal/Desert Portal Exit.prefab @@ -59,7 +59,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: bcd51a92199746578f25ab67160cc13d, type: 3} m_Name: m_EditorClassIdentifier: - portal: {fileID: 1249363658} + portal: {fileID: 3171802695548060926} --- !u!1 &698537097821251252 GameObject: m_ObjectHideFlags: 0 @@ -302,7 +302,8 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 2246995198243242195} - - component: {fileID: 1249363658} + - component: {fileID: 381431206272786088} + - component: {fileID: 3171802695548060926} m_Layer: 7 m_Name: Desert Portal Exit m_TagString: Untagged @@ -326,7 +327,7 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &1249363658 +--- !u!114 &381431206272786088 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -335,7 +336,21 @@ MonoBehaviour: m_GameObject: {fileID: 5635962022185625128} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: ae59cddbf8fa37549bb38b1039feeb34, type: 3} + m_Script: {fileID: 11500000, guid: 17de1e2991b64847bceea06f966f0560, type: 3} + m_Name: + m_EditorClassIdentifier: + color: {r: 8, g: 3.5137255, b: 0, a: 1} + emissionRenderer: {fileID: 3208325555222820191} +--- !u!114 &3171802695548060926 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5635962022185625128} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 20837d5efd544d3eb07657f581cb76d2, type: 3} m_Name: m_EditorClassIdentifier: size: {x: 2, y: 1} @@ -465,7 +480,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: minNearClipPlane: 0.0001 - portal: {fileID: 1249363658} + portal: {fileID: 3171802695548060926} screen: {fileID: 3566871879873967933} --- !u!1 &8849014083961458004 GameObject: diff --git a/Assets/Desert/Assets/Prefabs/Desert Environment.prefab b/Assets/Desert/Assets/Prefabs/Desert Environment.prefab index 394d62d..1da1290 100644 --- a/Assets/Desert/Assets/Prefabs/Desert Environment.prefab +++ b/Assets/Desert/Assets/Prefabs/Desert Environment.prefab @@ -32,38 +32,6 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &7280908611734617658 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 895589781461088420} - m_Layer: 0 - m_Name: Desert Scale - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 2147483647 - m_IsActive: 1 ---- !u!4 &895589781461088420 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 7280908611734617658} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 1 - m_Children: - - {fileID: 574765980742794756} - m_Father: {fileID: 7933998900790106032} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &8236754837553209924 GameObject: m_ObjectHideFlags: 0 @@ -92,84 +60,108 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 895589781461088420} + - {fileID: 8825350056022503906} m_Father: {fileID: 7626240558108670521} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &2434868707875363028 +--- !u!1001 &9075677266218620425 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: serializedVersion: 2 - m_TransformParent: {fileID: 895589781461088420} + m_TransformParent: {fileID: 7933998900790106032} m_Modifications: - - target: {fileID: 100443119660398373, guid: cc21a746bc450c74b8ecfc78f142849a, - type: 3} - propertyPath: m_Name - value: Desert Floor Tile - objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_RootOrder - value: 0 + value: -1 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalPosition.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalPosition.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalPosition.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalRotation.w - value: 1 + value: 0.7071067 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0.7071068 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalEulerAnglesHint.x value: 0 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalEulerAnglesHint.y value: 0 objectReference: {fileID: 0} - - target: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: -7511558181221131132, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: e754492879cc0db4fa31c48e5d57ea8c, type: 2} + - target: {fileID: 919132149155446097, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, + type: 3} + propertyPath: m_Name + value: Desert Floor + objectReference: {fileID: 0} m_RemovedComponents: [] m_AddedGameObjects: [] - m_SourcePrefab: {fileID: 100100000, guid: cc21a746bc450c74b8ecfc78f142849a, type: 3} ---- !u!4 &574765980742794756 stripped -Transform: - m_CorrespondingSourceObject: {fileID: 2752718264336852688, guid: cc21a746bc450c74b8ecfc78f142849a, + m_SourcePrefab: {fileID: 100100000, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} +--- !u!1 &8156618926076308312 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} - m_PrefabInstance: {fileID: 2434868707875363028} + m_PrefabInstance: {fileID: 9075677266218620425} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1902631214646309221 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8156618926076308312} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 496991ba2bf54e1e854a171f18180c54, type: 3} + m_Name: + m_EditorClassIdentifier: + objectToDisable: {fileID: 5743657079028767629} +--- !u!4 &8825350056022503906 stripped +Transform: + m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, + type: 3} + m_PrefabInstance: {fileID: 9075677266218620425} m_PrefabAsset: {fileID: 0} diff --git a/Assets/Desert/Assets/Prefabs/Desert Floor Tile.prefab b/Assets/Desert/Assets/Prefabs/Desert Floor Tile.prefab deleted file mode 100644 index 2dd9077..0000000 --- a/Assets/Desert/Assets/Prefabs/Desert Floor Tile.prefab +++ /dev/null @@ -1,114 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!1 &100443119660398373 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2752718264336852688} - m_Layer: 0 - m_Name: Desert Floor Tile - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &2752718264336852688 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 100443119660398373} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: - - {fileID: 6607789105031014710} - m_Father: {fileID: 0} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &6645391460334866141 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - m_TransformParent: {fileID: 2752718264336852688} - m_Modifications: - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_RootOrder - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalPosition.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalRotation.w - value: 0.7071067 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalRotation.x - value: -0.7071068 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: -7511558181221131132, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_Materials.Array.data[0] - value: - objectReference: {fileID: 2100000, guid: e754492879cc0db4fa31c48e5d57ea8c, type: 2} - - target: {fileID: 919132149155446097, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - propertyPath: m_Name - value: Desert Floor - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, type: 3} ---- !u!4 &6607789105031014710 stripped -Transform: - m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: 3a11a6b6fc0ad1a429fa098c08e2c361, - type: 3} - m_PrefabInstance: {fileID: 6645391460334866141} - m_PrefabAsset: {fileID: 0} diff --git a/Assets/Desert/Assets/Prefabs/Desert Floor Tile.prefab.meta b/Assets/Desert/Assets/Prefabs/Desert Floor Tile.prefab.meta deleted file mode 100644 index be822d7..0000000 --- a/Assets/Desert/Assets/Prefabs/Desert Floor Tile.prefab.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: cc21a746bc450c74b8ecfc78f142849a -PrefabImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Desert/Runtime/Desert.asmdef b/Assets/Desert/Runtime/Desert.asmdef index a085e66..f34f227 100644 --- a/Assets/Desert/Runtime/Desert.asmdef +++ b/Assets/Desert/Runtime/Desert.asmdef @@ -3,6 +3,7 @@ "rootNamespace": "EscapeRoomEngine", "references": [ "GUID:2d68e204354e44f2a2ecf3cfa9213c5f", + "GUID:ba4c7dba98ca4c31818cc46276b5dea1", "GUID:776d03a35f1b52c4a9aed9f56d7b4229" ], "includePlatforms": [], diff --git a/Assets/Desert/Runtime/Portal.meta b/Assets/Desert/Runtime/Portal.meta new file mode 100644 index 0000000..3b88847 --- /dev/null +++ b/Assets/Desert/Runtime/Portal.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 788a501fd6ac4d74bc34a49c99b02fc2 +timeCreated: 1670792890 \ No newline at end of file diff --git a/Assets/Desert/Runtime/Portal/DesertPortal.cs b/Assets/Desert/Runtime/Portal/DesertPortal.cs new file mode 100644 index 0000000..a60d48f --- /dev/null +++ b/Assets/Desert/Runtime/Portal/DesertPortal.cs @@ -0,0 +1,34 @@ +using EscapeRoomEngine.Engine.Runtime.Modules; +using UnityEngine; + +namespace EscapeRoomEngine.Desert.Runtime.Portal +{ + [RequireComponent(typeof(Emission))] + public class DesertPortal : EscapeRoomEngine.Portal.Runtime.Portal + { + private Emission _emission; + + protected override void Awake() + { + base.Awake(); + + _emission = GetComponent(); + + DoorEvent += (_, type) => + { + // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault ConvertSwitchStatementToSwitchExpression + switch (type) + { + case DoorEventType.Unlocked: + _emission.color = Engine.Runtime.Engine.DefaultEngine.theme.solvedColor.hdr; + break; + case DoorEventType.Locked: + _emission.color = Engine.Runtime.Engine.DefaultEngine.theme.puzzleColor.hdr; + break; + } + }; + + _emission.active = true; + } + } +} \ No newline at end of file diff --git a/Assets/Desert/Runtime/Portal/DesertPortal.cs.meta b/Assets/Desert/Runtime/Portal/DesertPortal.cs.meta new file mode 100644 index 0000000..fb369a0 --- /dev/null +++ b/Assets/Desert/Runtime/Portal/DesertPortal.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 20837d5efd544d3eb07657f581cb76d2 +timeCreated: 1670792901 \ No newline at end of file diff --git a/Assets/Engine/Assets/Module Descriptions/Spawn.asset b/Assets/Engine/Assets/Module Descriptions/Spawn.asset index 8b413a6..6703ffb 100644 --- a/Assets/Engine/Assets/Module Descriptions/Spawn.asset +++ b/Assets/Engine/Assets/Module Descriptions/Spawn.asset @@ -13,7 +13,7 @@ MonoBehaviour: m_Name: Spawn m_EditorClassIdentifier: types: 00000000 - modulePrefab: {fileID: 2388501677731357498, guid: db5350cd22f3a0f4f818a5f985342136, + modulePrefab: {fileID: 5940521204297009715, guid: db5350cd22f3a0f4f818a5f985342136, type: 3} preconditionRequirements: [] placementRequirements: diff --git a/Assets/Engine/Runtime/Engine.cs b/Assets/Engine/Runtime/Engine.cs index b781e5f..fbce279 100644 --- a/Assets/Engine/Runtime/Engine.cs +++ b/Assets/Engine/Runtime/Engine.cs @@ -116,11 +116,25 @@ namespace EscapeRoomEngine.Engine.Runtime room.AddSpace(space, exit); } - public void HidePreviousRoom() + public void HidePreviousRoom(bool destroy = true) { - if (NumberOfRooms > 1) + if (NumberOfRooms > 2) { - _rooms[NumberOfRooms - 2].roomObject.SetActive(false); + var room = _rooms[NumberOfRooms - 3]; + + // lock the doors that might be used to return to the old room + room.exit.toIn.DoorState.Lock(); + room.exit.fromOut.DoorState.Lock(); + + // destroy or hide the old room + if (destroy) + { + Destroy(room.roomObject); + } + else + { + room.roomObject.SetActive(false); + } } } diff --git a/Assets/Engine/Runtime/Modules/DoorState.cs b/Assets/Engine/Runtime/Modules/DoorState.cs index 270fae6..f4c0b92 100644 --- a/Assets/Engine/Runtime/Modules/DoorState.cs +++ b/Assets/Engine/Runtime/Modules/DoorState.cs @@ -54,7 +54,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules internal void Lock() => Unlocked = false; [Button(enabledMode: EButtonEnableMode.Playmode)] - internal void ExitFrom() => OnDoorEvent(DoorEventType.ExitedFrom); + protected internal void ExitFrom() => OnDoorEvent(DoorEventType.ExitedFrom); #endregion diff --git a/Assets/Engine/Runtime/Room.cs b/Assets/Engine/Runtime/Room.cs index af31d9f..3120b79 100644 --- a/Assets/Engine/Runtime/Room.cs +++ b/Assets/Engine/Runtime/Room.cs @@ -67,24 +67,22 @@ namespace EscapeRoomEngine.Engine.Runtime internal void AddDoor(DoorModule door) { _doors.Add(door); - door.DoorState.DoorEvent += OnDoorEvent; - } - - private void OnDoorEvent(DoorModule door, DoorEventType type) - { - // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault - switch (type) + door.DoorState.DoorEvent += (_, type) => { - // generate a new room as soon as the player completes all puzzles in this one - case DoorEventType.Unlocked when door.Equals(exit.fromOut): - Engine.DefaultEngine.GenerateRoom(); - break; - // start measurements on every puzzle as soon as the player enters this room - case DoorEventType.ExitedFrom when door.Equals(entrance.toIn): - _puzzles.ForEach(puzzle => Measure.StartMeasuring((PuzzleModuleDescription)puzzle.description)); - Engine.DefaultEngine.HidePreviousRoom(); - break; - } + // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault + switch (type) + { + // generate a new room as soon as the player completes all puzzles in this one + case DoorEventType.Unlocked when door.Equals(exit.fromOut): + Engine.DefaultEngine.GenerateRoom(); + break; + // start measurements on every puzzle as soon as the player enters the last room + case DoorEventType.ExitedFrom when door.Equals(entrance.toIn) && Engine.DefaultEngine.CurrentRoom.Contains(this): + _puzzles.ForEach(puzzle => Measure.StartMeasuring((PuzzleModuleDescription)puzzle.description)); + Engine.DefaultEngine.HidePreviousRoom(); + break; + } + }; } internal void InstantiateRoom(Transform parent, Vector3 offset, string name) @@ -99,6 +97,7 @@ namespace EscapeRoomEngine.Engine.Runtime } entrance.ConnectDoors(); + entrance.toIn.DoorState.Unlock(); } public override string ToString() diff --git a/Assets/Engine/Runtime/Utilities/DisablePicking.cs b/Assets/Engine/Runtime/Utilities/DisablePicking.cs new file mode 100644 index 0000000..b54a145 --- /dev/null +++ b/Assets/Engine/Runtime/Utilities/DisablePicking.cs @@ -0,0 +1,17 @@ +using UnityEditor; +using UnityEngine; + +namespace EscapeRoomEngine.Desert.Runtime +{ + public class DisablePicking : MonoBehaviour + { + public GameObject objectToDisable; + + private void Start() + { + #if UNITY_EDITOR + SceneVisibilityManager.instance.DisablePicking(objectToDisable, true); + #endif + } + } +} \ No newline at end of file diff --git a/Assets/Engine/Runtime/Utilities/DisablePicking.cs.meta b/Assets/Engine/Runtime/Utilities/DisablePicking.cs.meta new file mode 100644 index 0000000..61c5ea5 --- /dev/null +++ b/Assets/Engine/Runtime/Utilities/DisablePicking.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 496991ba2bf54e1e854a171f18180c54 +timeCreated: 1670798898 \ No newline at end of file diff --git a/Assets/Portal/Runtime/Portal.cs b/Assets/Portal/Runtime/Portal.cs index 2dc1012..250d1be 100644 --- a/Assets/Portal/Runtime/Portal.cs +++ b/Assets/Portal/Runtime/Portal.cs @@ -27,15 +27,23 @@ namespace EscapeRoomEngine.Portal.Runtime internal bool Connected => linkedPortal != null; internal readonly List closePortalDrivers = new(); - private void Awake() + protected virtual void Awake() { DoorEvent += (_, type) => { - if (type == DoorEventType.Connected) + // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault + switch (type) { - linkedPortal = FromDoorState(Module.ConnectedDoorState); - portalCamera.screen.gameObject.SetActive(true); - portalCamera.enabled = true; + case DoorEventType.Connected: + linkedPortal = FromDoorState(Module.ConnectedDoorState); + portalCamera.screen.gameObject.SetActive(true); + portalCamera.enabled = true; + break; + case DoorEventType.Locked: + portalCamera.enabled = false; + portalCamera.screen.gameObject.SetActive(false); + linkedPortal = null; + break; } }; } @@ -54,7 +62,7 @@ namespace EscapeRoomEngine.Portal.Runtime portalDriver.Teleport(this, linkedPortal); if (portalDriver.player) { - linkedPortal.OnDoorEvent(DoorEventType.ExitedFrom); + linkedPortal.ExitFrom(); } i--; // decrease the loop counter because the list is one element smaller now } diff --git a/Assets/Portal/Runtime/PortalDriver.cs b/Assets/Portal/Runtime/PortalDriver.cs index 63183b7..bc969b3 100644 --- a/Assets/Portal/Runtime/PortalDriver.cs +++ b/Assets/Portal/Runtime/PortalDriver.cs @@ -44,20 +44,24 @@ namespace EscapeRoomEngine.Portal.Runtime protected void Start() { if (hasClone) + { clone = PortalDriverClone.Create(this); + } } private void Update() { if (hasClone && clone.gameObject.activeSelf) + { clone.UpdatePosition(transform); + } } public void EnableClone(Portal at) { if (hasClone) { - Logger.Log($"Enabled {clone}", LogType.Portals); + Logger.Log($"Enabled {clone} at {at}", LogType.Portals); clone.portal = at; clone.gameObject.SetActive(true); @@ -68,7 +72,7 @@ namespace EscapeRoomEngine.Portal.Runtime { if (hasClone && at.Equals(clone.portal)) // don't disable clones that are already at a different portal { - Logger.Log($"Disabled {clone}", LogType.Portals); + Logger.Log($"Disabled {clone} at {clone.portal}", LogType.Portals); clone.portal = null; clone.gameObject.SetActive(false); diff --git a/Assets/Portal/Runtime/PortalDriverClone.cs b/Assets/Portal/Runtime/PortalDriverClone.cs index 10682ca..403ea9c 100644 --- a/Assets/Portal/Runtime/PortalDriverClone.cs +++ b/Assets/Portal/Runtime/PortalDriverClone.cs @@ -40,5 +40,10 @@ namespace EscapeRoomEngine.Portal.Runtime portal.linkedPortal.portalTransform.worldToLocalMatrix * cloning.localToWorldMatrix; transform.SetPositionAndRotation(m.GetPosition(), m.rotation); } + + public override string ToString() + { + return gameObject.name; + } } } diff --git a/Assets/Scenes/TestScene.unity b/Assets/Scenes/TestScene.unity index 0266171..8276bf5 100644 --- a/Assets/Scenes/TestScene.unity +++ b/Assets/Scenes/TestScene.unity @@ -680,7 +680,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: loggingEnabled: 1 - typeFilter: 0000000009000000 + typeFilter: 00000000 --- !u!114 &1568048339 MonoBehaviour: m_ObjectHideFlags: 0