diff --git a/Assets/Escape Room Engine/Engine/Materials/Generic Material A.mat b/Assets/Escape Room Engine/Engine/Materials/Generic Material A.mat new file mode 100644 index 0000000..a242500 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Materials/Generic Material A.mat @@ -0,0 +1,126 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7117340174757956021 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Generic Material A + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _Blend: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 1, g: 0, b: 0, a: 1} + - _Color: {r: 1, g: 0, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Escape Room Engine/Engine/Materials/Generic Material A.mat.meta b/Assets/Escape Room Engine/Engine/Materials/Generic Material A.mat.meta new file mode 100644 index 0000000..78ea475 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Materials/Generic Material A.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3e334d6799a0d0040a41fe4794da90f5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Materials/Generic Material B.mat b/Assets/Escape Room Engine/Engine/Materials/Generic Material B.mat new file mode 100644 index 0000000..e6e5a3b --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Materials/Generic Material B.mat @@ -0,0 +1,126 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-7117340174757956021 +MonoBehaviour: + m_ObjectHideFlags: 11 + 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: d0353a89b1f911e48b9e16bdc9f2e058, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 5 +--- !u!21 &2100000 +Material: + serializedVersion: 8 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Generic Material B + m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3} + m_ValidKeywords: [] + m_InvalidKeywords: [] + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: + RenderType: Opaque + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BaseMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _SpecGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_Lightmaps: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_LightmapsInd: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - unity_ShadowMasks: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Ints: [] + m_Floats: + - _AlphaClip: 0 + - _Blend: 0 + - _BumpScale: 1 + - _ClearCoatMask: 0 + - _ClearCoatSmoothness: 0 + - _Cull: 2 + - _Cutoff: 0.5 + - _DetailAlbedoMapScale: 1 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _EnvironmentReflections: 1 + - _GlossMapScale: 0 + - _Glossiness: 0 + - _GlossyReflections: 0 + - _Metallic: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.005 + - _QueueOffset: 0 + - _ReceiveShadows: 1 + - _Smoothness: 0.5 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _Surface: 0 + - _WorkflowMode: 1 + - _ZWrite: 1 + m_Colors: + - _BaseColor: {r: 0, g: 1, b: 0, a: 1} + - _Color: {r: 0, g: 1, b: 0, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} + - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} + m_BuildTextureStacks: [] diff --git a/Assets/Escape Room Engine/Engine/Materials/Generic Material B.mat.meta b/Assets/Escape Room Engine/Engine/Materials/Generic Material B.mat.meta new file mode 100644 index 0000000..7e872f0 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Materials/Generic Material B.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 94d63268ac1ac034d8c0af72dd04a346 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Module Descriptions.meta b/Assets/Escape Room Engine/Engine/Module Descriptions.meta new file mode 100644 index 0000000..6414d11 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Module Descriptions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: cbca1f72962acd84f99c381bc7e55a4a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Entrance Description.asset b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Entrance Description.asset new file mode 100644 index 0000000..42ff1c1 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Entrance Description.asset @@ -0,0 +1,19 @@ +%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: f5c1202346c34ebc9c3f701a98b50877, type: 3} + m_Name: Generic Door Entrance Description + m_EditorClassIdentifier: + modulePrefab: {fileID: 5399176795272327488, guid: da9b7a57e7c37d149827fe17188bdeea, + type: 3} + doorType: 0 + connectedDoorDescription: {fileID: 11400000, guid: 9f41a4c77b171754884cdf194aa156ea, + type: 2} diff --git a/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Entrance Description.asset.meta b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Entrance Description.asset.meta new file mode 100644 index 0000000..bb32b05 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Entrance Description.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d28f4ecf66835b74894687865fe95018 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Exit Description.asset b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Exit Description.asset new file mode 100644 index 0000000..a8b9dee --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Exit Description.asset @@ -0,0 +1,19 @@ +%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: f5c1202346c34ebc9c3f701a98b50877, type: 3} + m_Name: Generic Door Exit Description + m_EditorClassIdentifier: + modulePrefab: {fileID: 5399176795272327488, guid: d877ee36ba6ace440aebce2c20cf70d6, + type: 3} + doorType: 1 + connectedDoorDescription: {fileID: 11400000, guid: d28f4ecf66835b74894687865fe95018, + type: 2} diff --git a/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Exit Description.asset.meta b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Exit Description.asset.meta new file mode 100644 index 0000000..437489d --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Door Exit Description.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9f41a4c77b171754884cdf194aa156ea +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Module Description.asset b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Module Description.asset new file mode 100644 index 0000000..cb6a4cc --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Module Description.asset @@ -0,0 +1,16 @@ +%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: abf4a405f6c64073995bded39977563e, type: 3} + m_Name: Generic Module Description + m_EditorClassIdentifier: + modulePrefab: {fileID: 3864228228344123331, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} diff --git a/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Module Description.asset.meta b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Module Description.asset.meta new file mode 100644 index 0000000..d5e28ed --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Module Descriptions/Generic Module Description.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7400e74756d4cc049b9af0469bba3e00 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Module Descriptions/Spawn Description.asset b/Assets/Escape Room Engine/Engine/Module Descriptions/Spawn Description.asset new file mode 100644 index 0000000..5493829 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Module Descriptions/Spawn Description.asset @@ -0,0 +1,18 @@ +%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: f5c1202346c34ebc9c3f701a98b50877, type: 3} + m_Name: Spawn Description + m_EditorClassIdentifier: + modulePrefab: {fileID: 278361332033420131, guid: db5350cd22f3a0f4f818a5f985342136, + type: 3} + doorType: 0 + connectedDoorDescription: {fileID: 11400000} diff --git a/Assets/Escape Room Engine/Engine/Module Descriptions/Spawn Description.asset.meta b/Assets/Escape Room Engine/Engine/Module Descriptions/Spawn Description.asset.meta new file mode 100644 index 0000000..86e17b8 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Module Descriptions/Spawn Description.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0e4c15f85acfd754997a7a9d04c19c3e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Prefabs.meta b/Assets/Escape Room Engine/Engine/Prefabs.meta new file mode 100644 index 0000000..b1a9075 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 13e3048f21bad284b91f2b72d7c0d47d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Entrance.prefab b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Entrance.prefab new file mode 100644 index 0000000..8b50377 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Entrance.prefab @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &5062520571022203852 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 913127997918145164, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_Name + value: Generic Door Entrance + objectReference: {fileID: 0} + - target: {fileID: 4775571204437220950, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 94d63268ac1ac034d8c0af72dd04a346, type: 2} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 30bf75759c019b843afd4c6aeb694159, type: 3} diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Entrance.prefab.meta b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Entrance.prefab.meta new file mode 100644 index 0000000..905c74a --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Entrance.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: da9b7a57e7c37d149827fe17188bdeea +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Exit.prefab b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Exit.prefab new file mode 100644 index 0000000..bd7d589 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Exit.prefab @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &5062520571022203852 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 913127997918145164, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_Name + value: Generic Door Exit + objectReference: {fileID: 0} + - target: {fileID: 4775571204437220950, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_Materials.Array.data[0] + value: + objectReference: {fileID: 2100000, guid: 3e334d6799a0d0040a41fe4794da90f5, type: 2} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 30bf75759c019b843afd4c6aeb694159, type: 3} diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Exit.prefab.meta b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Exit.prefab.meta new file mode 100644 index 0000000..a073bff --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door Exit.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d877ee36ba6ace440aebce2c20cf70d6 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Generic Door.prefab b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door.prefab new file mode 100644 index 0000000..267f235 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door.prefab @@ -0,0 +1,81 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1001 &4110777154808243535 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 3864228228344123331, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_Name + value: Generic Door + objectReference: {fileID: 0} + - target: {fileID: 7279153380729290489, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalScale.y + value: 2 + objectReference: {fileID: 0} + - target: {fileID: 7279153380729290489, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalPosition.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 7860513085978939562, guid: ad2655de8289afa40aa520f9fc474681, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: ad2655de8289afa40aa520f9fc474681, type: 3} diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Generic Door.prefab.meta b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door.prefab.meta new file mode 100644 index 0000000..a961c01 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Generic Door.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 30bf75759c019b843afd4c6aeb694159 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Generic Module.prefab b/Assets/Escape Room Engine/Engine/Prefabs/Generic Module.prefab new file mode 100644 index 0000000..0c714c1 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Generic Module.prefab @@ -0,0 +1,131 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3864228228344123331 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7860513085978939562} + m_Layer: 0 + m_Name: Generic Module + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7860513085978939562 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3864228228344123331} + 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: 7279153380729290489} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &4439105426094897912 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7279153380729290489} + - component: {fileID: 609314626751263072} + - component: {fileID: 8884008595548699417} + - component: {fileID: 3037682669808127519} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &7279153380729290489 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4439105426094897912} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0.5, y: 0.5, z: 0.5} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 7860513085978939562} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &609314626751263072 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4439105426094897912} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &8884008595548699417 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4439105426094897912} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!65 &3037682669808127519 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4439105426094897912} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Generic Module.prefab.meta b/Assets/Escape Room Engine/Engine/Prefabs/Generic Module.prefab.meta new file mode 100644 index 0000000..c419bde --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Generic Module.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ad2655de8289afa40aa520f9fc474681 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Spawn.prefab b/Assets/Escape Room Engine/Engine/Prefabs/Spawn.prefab new file mode 100644 index 0000000..912815b --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Spawn.prefab @@ -0,0 +1,179 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &6011647874759208035 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5928148369176390461} + - component: {fileID: 5083806700704616900} + - component: {fileID: 3214657300310728549} + - component: {fileID: 8608837451192070870} + m_Layer: 0 + m_Name: Sphere + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &5928148369176390461 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6011647874759208035} + 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: [] + m_Father: {fileID: 6587262333262160906} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &5083806700704616900 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6011647874759208035} + m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0} +--- !u!23 &3214657300310728549 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6011647874759208035} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_StaticShadowCaster: 0 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RayTracingMode: 2 + m_RayTraceProcedural: 0 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_ReceiveGI: 1 + m_PreserveUVs: 0 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 1 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 + m_AdditionalVertexStreams: {fileID: 0} +--- !u!135 &8608837451192070870 +SphereCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6011647874759208035} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Radius: 0.5 + m_Center: {x: 0, y: 0, z: 0} +--- !u!1001 &1112641151226188271 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 330650459340005303, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 913127997918145164, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_Name + value: Spawn + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalPosition.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalPosition.z + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 30bf75759c019b843afd4c6aeb694159, type: 3} +--- !u!4 &6587262333262160906 stripped +Transform: + m_CorrespondingSourceObject: {fileID: 6060240960858060261, guid: 30bf75759c019b843afd4c6aeb694159, + type: 3} + m_PrefabInstance: {fileID: 1112641151226188271} + m_PrefabAsset: {fileID: 0} diff --git a/Assets/Escape Room Engine/Engine/Prefabs/Spawn.prefab.meta b/Assets/Escape Room Engine/Engine/Prefabs/Spawn.prefab.meta new file mode 100644 index 0000000..e688738 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Prefabs/Spawn.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: db5350cd22f3a0f4f818a5f985342136 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Escape Room Engine/Engine/Scripts/Engine.cs b/Assets/Escape Room Engine/Engine/Scripts/Engine.cs index 67e0549..9c89848 100644 --- a/Assets/Escape Room Engine/Engine/Scripts/Engine.cs +++ b/Assets/Escape Room Engine/Engine/Scripts/Engine.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +using System.Linq; using Escape_Room_Engine.Engine.Scripts.Modules; +using Escape_Room_Engine.Engine.Scripts.Utilities; using UnityEngine; using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger; using LogType = Escape_Room_Engine.Engine.Scripts.Utilities.LogType; @@ -27,6 +29,9 @@ namespace Escape_Room_Engine.Engine.Scripts [Tooltip("The minimum size that should be allowed for rooms.")] public Vector2Int minRoomSize; [Tooltip("The size of the physical play space available to the engine.")] public Vector2Int playSpace; + public ModuleDescription genericModule; + public DoorModuleDescription spawnDoor; + public List exitDoorTypes; private int NumberOfRooms => _rooms.Count; @@ -45,12 +50,13 @@ namespace Escape_Room_Engine.Engine.Scripts Logger.Log("Generating room...", LogType.RoomGeneration); // get the last entrance from the newest room or create a spawn passage with no entrance door for where the player will start - var entrance = NumberOfRooms > 0 ? _rooms[0].exit : new SpawnPassage(); + var entrance = NumberOfRooms > 0 ? _rooms.Last().exit : new Passage(new DoorModule(null, spawnDoor), true); var room = new Room(entrance); _rooms.Add(room); GenerateSpace(room, entrance); // TODO: rooms with more than one space + room.InstantiateRoom(_playSpaceOrigin.transform, (_rooms.Count - 1).ToString()); } @@ -63,7 +69,7 @@ namespace Escape_Room_Engine.Engine.Scripts var space = new Space(rrDimensions, entrance); // add exit - var exitDoor = new DoorModule(DoorType.Exit, space); + var exitDoor = new DoorModule(space, exitDoorTypes.RandomElement()); exitDoor.Place(new Vector2Int( Random.Range(0, rrDimensions.width), Random.Range(0, rrDimensions.length) @@ -86,7 +92,7 @@ namespace Escape_Room_Engine.Engine.Scripts Math.Min(entranceRrPosition.x, playSpace.x - minRoomSize.x) ); var xMax = Utilities.Utilities.RandomInclusive( - Math.Max(entranceRrPosition.x, xMin + minRoomSize.x), + Math.Max(entranceRrPosition.x + 1, xMin + minRoomSize.x), playSpace.x ); var zMin = Utilities.Utilities.RandomInclusive( @@ -94,13 +100,13 @@ namespace Escape_Room_Engine.Engine.Scripts Math.Min(entranceRrPosition.y, playSpace.y - minRoomSize.y) ); var zMax = Utilities.Utilities.RandomInclusive( - Math.Max(entranceRrPosition.y, zMin + minRoomSize.y), + Math.Max(entranceRrPosition.y + 1, zMin + minRoomSize.y), playSpace.y ); var dimensions = new Dimensions(xMax - xMin, zMax - zMin, xMin, zMin); - Logger.Log($"Generated space dimensions {dimensions}", LogType.RoomGeneration); + Logger.Log($"Generated space dimensions {dimensions} from entrance position {entranceRrPosition}", LogType.RoomGeneration); return dimensions; } @@ -112,17 +118,5 @@ namespace Escape_Room_Engine.Engine.Scripts _rooms[NumberOfRooms - 1].roomObject.SetActive(false); } } - - /// - /// Dispose of the oldest room to save resources. - /// - public void DisposeOldestRoom() - { - if (NumberOfRooms > 0) - { - _rooms[NumberOfRooms - 1].Destroy(); - _rooms.RemoveAt(NumberOfRooms - 1); - } - } } } diff --git a/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModule.cs b/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModule.cs index b28b47b..11ae019 100644 --- a/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModule.cs +++ b/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModule.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using System; +using UnityEngine; namespace Escape_Room_Engine.Engine.Scripts.Modules { @@ -7,14 +8,15 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules Entrance = ModuleType.DoorEntrance, Exit = ModuleType.DoorExit } + [Serializable] public class DoorModule : Module { public bool IsEntrance => IsType((ModuleType)DoorType.Entrance); public bool IsExit => IsType((ModuleType)DoorType.Exit); - internal DoorModule(DoorType type, Space space) : base(space) + internal DoorModule(Space space, DoorModuleDescription description) : base(space, description) { - types.Add((ModuleType)type); + _description.types.Add((ModuleType)description.doorType); srDimensions.Size = Vector2Int.one; // door always has size 1x1 } diff --git a/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModuleDescription.cs b/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModuleDescription.cs new file mode 100644 index 0000000..a89450a --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModuleDescription.cs @@ -0,0 +1,15 @@ +using UnityEngine; + +namespace Escape_Room_Engine.Engine.Scripts.Modules +{ + [CreateAssetMenu(menuName = "Door Module")] + public class DoorModuleDescription : ModuleDescription + { + public DoorType doorType; + /// + /// The description for the door that should be connected with this one. + /// If this is a teleporter entrance, the connected door should be a teleporter exit. + /// + public DoorModuleDescription connectedDoorDescription; + } +} \ No newline at end of file diff --git a/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModuleDescription.cs.meta b/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModuleDescription.cs.meta new file mode 100644 index 0000000..41a8cf3 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Scripts/Modules/DoorModuleDescription.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f5c1202346c34ebc9c3f701a98b50877 +timeCreated: 1667833660 \ No newline at end of file diff --git a/Assets/Escape Room Engine/Engine/Scripts/Modules/Module.cs b/Assets/Escape Room Engine/Engine/Scripts/Modules/Module.cs index 0abebf2..1d53d67 100644 --- a/Assets/Escape Room Engine/Engine/Scripts/Modules/Module.cs +++ b/Assets/Escape Room Engine/Engine/Scripts/Modules/Module.cs @@ -1,9 +1,10 @@ using System; -using System.Collections.Generic; +using System.Linq; using Escape_Room_Engine.Engine.Scripts.Utilities; using UnityEngine; using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger; using LogType = Escape_Room_Engine.Engine.Scripts.Utilities.LogType; +using Object = UnityEngine.Object; namespace Escape_Room_Engine.Engine.Scripts.Modules { @@ -16,43 +17,43 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules /// /// Get the room relative (RR) position of this module. /// - internal Vector2Int RrPosition => space.ToRoomRelative(SrPosition); + internal Vector2Int RrPosition => _space.ToRoomRelative(SrPosition); - internal readonly Space space; - + internal readonly ModuleDescription _description; protected GameObject _moduleObject; - protected readonly List types = new(); /// /// The space relative (SR) dimensions of this module. /// protected Dimensions srDimensions; - internal Module(Space space) + private readonly Space _space; + + internal Module(Space space, ModuleDescription description) { - this.space = space; + _space = space; + _description = description; } internal bool IsType(ModuleType type) { - return types.Contains(type); + return _description.types.Contains(type); } - /// /// Place this module with a position relative to the room. /// /// The room relative (RR) position of this module. Must be inside the space dimensions. /// If the position is not inside the space dimensions. - internal void PlaceRoomRelative(Vector2Int rrPosition) => Place(space.ToSpaceRelative(rrPosition)); + internal void PlaceRoomRelative(Vector2Int rrPosition) => Place(_space.ToSpaceRelative(rrPosition)); /// /// Place this module with a position relative to the space it is in. /// /// The space relative (SR) position of this module. Must be inside the space dimensions. /// If the position is not inside the space dimensions. internal void Place(Vector2Int srPosition) { - if (space != null && !srPosition.IsInsideRelative(space.rrDimensions)) + if (_space != null && !srPosition.IsInsideRelative(_space.rrDimensions)) { - throw new Exception($"Trying to place {this} at {srPosition}, which is outside space dimensions {space.rrDimensions}."); + throw new Exception($"Trying to place {this} at {srPosition}, which is outside space dimensions {_space.rrDimensions}."); } srDimensions.Position = srPosition; @@ -60,9 +61,18 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules Logger.Log($"{this} has been placed at {srPosition} (SR)", LogType.ModulePlacement); } + internal void InstantiateModule(Transform parent) + { + _moduleObject = new GameObject(ToString()); + _moduleObject.transform.SetParent(parent, false); + _moduleObject.transform.localPosition = new Vector3(srDimensions.x, 0, srDimensions.z); + + Object.Instantiate(_description.modulePrefab, _moduleObject.transform, false); + } + public override string ToString() { - return $"Module ({string.Join(',', types.ConvertAll(type => type.ToString()))})"; + return $"Module ({string.Join(',', _description.types.ToList().ConvertAll(type => type.ToString()))})"; } } } diff --git a/Assets/Escape Room Engine/Engine/Scripts/Modules/ModuleDescription.cs b/Assets/Escape Room Engine/Engine/Scripts/Modules/ModuleDescription.cs new file mode 100644 index 0000000..ed6e876 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Scripts/Modules/ModuleDescription.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace Escape_Room_Engine.Engine.Scripts.Modules +{ + [CreateAssetMenu(menuName = "Generic Module")] + public class ModuleDescription : ScriptableObject + { + public readonly HashSet types = new(); + public GameObject modulePrefab; + } +} \ No newline at end of file diff --git a/Assets/Escape Room Engine/Engine/Scripts/Modules/ModuleDescription.cs.meta b/Assets/Escape Room Engine/Engine/Scripts/Modules/ModuleDescription.cs.meta new file mode 100644 index 0000000..b661ff5 --- /dev/null +++ b/Assets/Escape Room Engine/Engine/Scripts/Modules/ModuleDescription.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: abf4a405f6c64073995bded39977563e +timeCreated: 1667831630 \ No newline at end of file diff --git a/Assets/Escape Room Engine/Engine/Scripts/Passage.cs b/Assets/Escape Room Engine/Engine/Scripts/Passage.cs index 45ff311..5f70b3c 100644 --- a/Assets/Escape Room Engine/Engine/Scripts/Passage.cs +++ b/Assets/Escape Room Engine/Engine/Scripts/Passage.cs @@ -1,5 +1,4 @@ -using System; -using Escape_Room_Engine.Engine.Scripts.Modules; +using Escape_Room_Engine.Engine.Scripts.Modules; using UnityEngine; using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger; using LogType = Escape_Room_Engine.Engine.Scripts.Utilities.LogType; @@ -14,34 +13,35 @@ namespace Escape_Room_Engine.Engine.Scripts /// internal Vector2Int rrPosition; - internal Passage(DoorModule from) + internal Passage(DoorModule from, bool spawnPassage = false) { - ConnectFrom(from); + if (spawnPassage) + { + fromOut = from; + rrPosition = Vector2Int.zero; + } + else + { + ConnectFrom(from); + } } - protected Passage() {} - internal void ConnectFrom(DoorModule door) { fromOut = door; rrPosition = fromOut.RrPosition; - Logger.Log($"Connected passage from {door} at {rrPosition} (RR).", LogType.PassageConnection); + Logger.Log($"Connected passage from {door} at {rrPosition} (RR)", LogType.PassageConnection); } - internal virtual void ConnectTo(DoorModule door) + internal void ConnectTo(DoorModule door) { - if (fromOut == null) - { - throw new Exception("Cannot connect passage to entrance if it hasn't been connected to an exit first."); - } - toIn = door; // to make sure the origin of the player doesn't move, the two doors must be placed in the same location toIn.PlaceRoomRelative(rrPosition); - Logger.Log($"Connected passage to {door} at {rrPosition} (RR).", LogType.PassageConnection); + Logger.Log($"Connected passage to {door} at {rrPosition} (RR)", LogType.PassageConnection); } } } \ No newline at end of file diff --git a/Assets/Escape Room Engine/Engine/Scripts/Space.cs b/Assets/Escape Room Engine/Engine/Scripts/Space.cs index a875015..5eaecac 100644 --- a/Assets/Escape Room Engine/Engine/Scripts/Space.cs +++ b/Assets/Escape Room Engine/Engine/Scripts/Space.cs @@ -19,7 +19,8 @@ namespace Escape_Room_Engine.Engine.Scripts this.rrDimensions = rrDimensions; // connect the space to its passage - entrance.ConnectTo(new DoorModule(DoorType.Entrance, this)); + entrance.ConnectTo(new DoorModule(this, + ((DoorModuleDescription)entrance.fromOut._description).connectedDoorDescription)); AddModule(entrance.toIn); } @@ -39,6 +40,9 @@ namespace Escape_Room_Engine.Engine.Scripts var meshRenderer = _spaceObject.GetComponent(); meshRenderer.material = Engine.DefaultEngine.roomMaterial; + + // instantiate all modules inside this space + _modules.ForEach(module => module.InstantiateModule(_spaceObject.transform)); } /// diff --git a/Assets/Escape Room Engine/Engine/Scripts/SpawnPassage.cs b/Assets/Escape Room Engine/Engine/Scripts/SpawnPassage.cs deleted file mode 100644 index 6975de7..0000000 --- a/Assets/Escape Room Engine/Engine/Scripts/SpawnPassage.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Escape_Room_Engine.Engine.Scripts.Modules; -using UnityEngine; - -namespace Escape_Room_Engine.Engine.Scripts -{ - /// - /// A SpawnPassage is a type of passage used solely for entering the very fist space. It always places the entrance door at (0, 0). - /// - public class SpawnPassage : Passage - { - internal SpawnPassage() {} - - internal override void ConnectTo(DoorModule door) - { - // this door module does not really exist, but is required since a passage must include an entry - // it also defines, where the exit will be placed (in this case always at the play space origin) - fromOut = new DoorModule(DoorType.Exit, null); - fromOut.Place(new Vector2Int(0, 0)); - - base.ConnectTo(door); - } - } -} \ No newline at end of file diff --git a/Assets/Escape Room Engine/Engine/Scripts/SpawnPassage.cs.meta b/Assets/Escape Room Engine/Engine/Scripts/SpawnPassage.cs.meta deleted file mode 100644 index 9447334..0000000 --- a/Assets/Escape Room Engine/Engine/Scripts/SpawnPassage.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 0a168ccfeb4e46b9a2c04442afef6c4c -timeCreated: 1667813431 \ No newline at end of file diff --git a/Assets/Escape Room Engine/Engine/Scripts/Utilities/Utilities.cs b/Assets/Escape Room Engine/Engine/Scripts/Utilities/Utilities.cs index 7d77017..c937845 100644 --- a/Assets/Escape Room Engine/Engine/Scripts/Utilities/Utilities.cs +++ b/Assets/Escape Room Engine/Engine/Scripts/Utilities/Utilities.cs @@ -1,12 +1,11 @@ -using UnityEngine; +using System.Collections.Generic; +using UnityEngine; namespace Escape_Room_Engine.Engine.Scripts.Utilities { public static class Utilities { #region Math - - public static int RandomInclusive(int from, int to) => Random.Range(from, to + 1); /// /// Returns whether a position relative to some dimensions is inside those dimensions. @@ -19,5 +18,13 @@ namespace Escape_Room_Engine.Engine.Scripts.Utilities } #endregion + + #region Randomness + + public static int RandomInclusive(int from, int to) => Random.Range(from, to + 1); + + public static T RandomElement(this List list) => list[Random.Range(0, list.Count)]; + + #endregion } } \ No newline at end of file diff --git a/Assets/Scenes/TestScene.unity b/Assets/Scenes/TestScene.unity index c3f528a..fc7b2e6 100644 --- a/Assets/Scenes/TestScene.unity +++ b/Assets/Scenes/TestScene.unity @@ -1235,6 +1235,10 @@ MonoBehaviour: roomMaterial: {fileID: 2100000, guid: 39e2ed014eda5d6408c16fbf0fa80781, type: 2} minRoomSize: {x: 3, y: 3} playSpace: {x: 4, y: 6} + genericModule: {fileID: 11400000, guid: 7400e74756d4cc049b9af0469bba3e00, type: 2} + spawnDoor: {fileID: 11400000, guid: 0e4c15f85acfd754997a7a9d04c19c3e, type: 2} + exitDoorTypes: + - {fileID: 11400000, guid: 9f41a4c77b171754884cdf194aa156ea, type: 2} --- !u!4 &1568048335 Transform: m_ObjectHideFlags: 0