From 0dc7eef753b9c64fd16da18ebd16736bb938a9f0 Mon Sep 17 00:00:00 2001 From: milan Date: Thu, 6 Apr 2023 09:12:15 +0200 Subject: [PATCH] fix portal placement --- .../Requirements/Place On Bottom Row.asset | 14 ++++++ .../Place On Bottom Row.asset.meta | 8 ++++ .../Placement/PlaceOnBottomRow.cs | 24 ++++++++++ .../Placement/PlaceOnBottomRow.cs.meta | 3 ++ .../D Station 46 Portal Exit.asset | 2 +- .../Portal/Station 46 Portal Entrance.prefab | 44 ++++++++++++++++--- .../Portal/Station 46 Portal Exit.prefab | 44 ++++++++++++++++--- Assets/Station46/Station 46.asset | 4 +- 8 files changed, 128 insertions(+), 15 deletions(-) create mode 100644 Assets/Engine/Assets/Requirements/Place On Bottom Row.asset create mode 100644 Assets/Engine/Assets/Requirements/Place On Bottom Row.asset.meta create mode 100644 Assets/Engine/Runtime/Requirements/Placement/PlaceOnBottomRow.cs create mode 100644 Assets/Engine/Runtime/Requirements/Placement/PlaceOnBottomRow.cs.meta diff --git a/Assets/Engine/Assets/Requirements/Place On Bottom Row.asset b/Assets/Engine/Assets/Requirements/Place On Bottom Row.asset new file mode 100644 index 0000000..14842ae --- /dev/null +++ b/Assets/Engine/Assets/Requirements/Place On Bottom Row.asset @@ -0,0 +1,14 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5aece1c1f67b46afaf249c4520a0478f, type: 3} + m_Name: Place On Bottom Row + m_EditorClassIdentifier: diff --git a/Assets/Engine/Assets/Requirements/Place On Bottom Row.asset.meta b/Assets/Engine/Assets/Requirements/Place On Bottom Row.asset.meta new file mode 100644 index 0000000..e495c6d --- /dev/null +++ b/Assets/Engine/Assets/Requirements/Place On Bottom Row.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 49248c593c97bff4f8889e5c4da6c1bb +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Engine/Runtime/Requirements/Placement/PlaceOnBottomRow.cs b/Assets/Engine/Runtime/Requirements/Placement/PlaceOnBottomRow.cs new file mode 100644 index 0000000..493074d --- /dev/null +++ b/Assets/Engine/Runtime/Requirements/Placement/PlaceOnBottomRow.cs @@ -0,0 +1,24 @@ +using System.Collections.Generic; +using EscapeRoomEngine.Engine.Runtime.Modules; +using UnityEngine; + +namespace EscapeRoomEngine.Engine.Runtime.Requirements.Placement +{ + /// + /// This requirement guarantees that the back side of the module is placed on the bottom row of the space. + /// + [CreateAssetMenu(menuName = "Requirements/Place On Bottom Row")] + public class PlaceOnBottomRow : PlacementRequirement + { + protected override List FilterCandidates(List candidates, Module module, Space space) + { + candidates.RemoveAll(candidate => + { + var (left, right) = candidate.BackCorners; + return !(left.z == 0 && right.z == 0); + }); + + return candidates; + } + } +} \ No newline at end of file diff --git a/Assets/Engine/Runtime/Requirements/Placement/PlaceOnBottomRow.cs.meta b/Assets/Engine/Runtime/Requirements/Placement/PlaceOnBottomRow.cs.meta new file mode 100644 index 0000000..b250717 --- /dev/null +++ b/Assets/Engine/Runtime/Requirements/Placement/PlaceOnBottomRow.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5aece1c1f67b46afaf249c4520a0478f +timeCreated: 1683644196 \ No newline at end of file diff --git a/Assets/Station46/Module Descriptions/D Station 46 Portal Exit.asset b/Assets/Station46/Module Descriptions/D Station 46 Portal Exit.asset index a1714b9..c7518bf 100644 --- a/Assets/Station46/Module Descriptions/D Station 46 Portal Exit.asset +++ b/Assets/Station46/Module Descriptions/D Station 46 Portal Exit.asset @@ -18,7 +18,7 @@ MonoBehaviour: preconditionRequirements: [] placementRequirements: - {fileID: 11400000, guid: 43eb2a566a244964aa3a3319eaafe1a8, type: 2} - - {fileID: 11400000, guid: ed4830127e9381245a6af07e42c52422, type: 2} + - {fileID: 11400000, guid: 49248c593c97bff4f8889e5c4da6c1bb, type: 2} - {fileID: 11400000, guid: 1f1825b71bae09c438a1cb52603347d6, type: 2} connectedDoorDescription: {fileID: 11400000, guid: 58d2a66244450b94d8a266569cb8d2fa, type: 2} diff --git a/Assets/Station46/Modules/Portal/Station 46 Portal Entrance.prefab b/Assets/Station46/Modules/Portal/Station 46 Portal Entrance.prefab index 3345ce8..b633d15 100644 --- a/Assets/Station46/Modules/Portal/Station 46 Portal Entrance.prefab +++ b/Assets/Station46/Modules/Portal/Station 46 Portal Entrance.prefab @@ -182,6 +182,38 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} +--- !u!1 &3937028285041533707 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3598993336778173019} + m_Layer: 7 + m_Name: Rotation + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &3598993336778173019 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3937028285041533707} + m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 6713443008366400661} + m_Father: {fileID: 2246995198243242195} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} --- !u!1 &5635962022185625128 GameObject: m_ObjectHideFlags: 0 @@ -212,7 +244,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 6713443008366400661} + - {fileID: 3598993336778173019} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -242,7 +274,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 20837d5efd544d3eb07657f581cb76d2, type: 3} m_Name: m_EditorClassIdentifier: - size: {x: 2, y: 1} + size: {x: 1, y: 1} linkedPortal: {fileID: 0} minNearClipPlane: 0.0001 screen: {fileID: 6419237152131296747} @@ -389,15 +421,15 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8849014083961458004} - m_LocalRotation: {x: -0, y: 1, z: -0, w: 0.00000043213367} - m_LocalPosition: {x: -0.5, y: 0, z: 0} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.5, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 8069972016317824103} - m_Father: {fileID: 2246995198243242195} + m_Father: {fileID: 3598993336778173019} m_RootOrder: -1 - m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &9139844951969793274 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Station46/Modules/Portal/Station 46 Portal Exit.prefab b/Assets/Station46/Modules/Portal/Station 46 Portal Exit.prefab index 4ef5b5b..d28a437 100644 --- a/Assets/Station46/Modules/Portal/Station 46 Portal Exit.prefab +++ b/Assets/Station46/Modules/Portal/Station 46 Portal Exit.prefab @@ -66,7 +66,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 5709573715699328820} + - {fileID: 2142869703928894347} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -96,11 +96,43 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 20837d5efd544d3eb07657f581cb76d2, type: 3} m_Name: m_EditorClassIdentifier: - size: {x: 2, y: 1} + size: {x: 1, y: 1} linkedPortal: {fileID: 0} minNearClipPlane: 0.0001 screen: {fileID: 844969720899552114} portalTransform: {fileID: 8080754438967713432} +--- !u!1 &3231959822301966204 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2142869703928894347} + m_Layer: 7 + m_Name: Rotation + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2142869703928894347 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3231959822301966204} + m_LocalRotation: {x: -0, y: 0.7071068, z: -0, w: 0.7071068} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 5709573715699328820} + m_Father: {fileID: 9212560043793041154} + m_RootOrder: -1 + m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0} --- !u!1 &3701970131638747585 GameObject: m_ObjectHideFlags: 0 @@ -464,15 +496,15 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8458413232787400471} - m_LocalRotation: {x: -0, y: 1, z: -0, w: 0.000000059604638} - m_LocalPosition: {x: -0.5, y: 0, z: -0.1} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0.5, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 7147726913666778841} - m_Father: {fileID: 9212560043793041154} + m_Father: {fileID: 2142869703928894347} m_RootOrder: -1 - m_LocalEulerAnglesHint: {x: 0, y: 180, z: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &9093302644436404973 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Station46/Station 46.asset b/Assets/Station46/Station 46.asset index 3ae4c03..2ec1b95 100644 --- a/Assets/Station46/Station 46.asset +++ b/Assets/Station46/Station 46.asset @@ -12,8 +12,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 28d04249c1c4438da94b524e7d4afff2, type: 3} m_Name: Station 46 m_EditorClassIdentifier: - minRoomSize: {x: 4, y: 2} - playSpace: {x: 4, y: 2} + minRoomSize: {x: 2, y: 4} + playSpace: {x: 2, y: 4} spaceTile: {fileID: 3229991053255736984, guid: b8f192f7cebe686468af6b1a71c4605b, type: 3} environment: {fileID: 5743657079028767629, guid: 17ecdbaca50efaa4ab503614dfec54a8,