generic doors

This commit is contained in:
2022-11-04 09:46:00 +01:00
parent 807eae1c62
commit ba4fa9430c
37 changed files with 1071 additions and 77 deletions

View File

@@ -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: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3e334d6799a0d0040a41fe4794da90f5
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 94d63268ac1ac034d8c0af72dd04a346
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cbca1f72962acd84f99c381bc7e55a4a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d28f4ecf66835b74894687865fe95018
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9f41a4c77b171754884cdf194aa156ea
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7400e74756d4cc049b9af0469bba3e00
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0e4c15f85acfd754997a7a9d04c19c3e
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 13e3048f21bad284b91f2b72d7c0d47d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: da9b7a57e7c37d149827fe17188bdeea
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d877ee36ba6ace440aebce2c20cf70d6
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 30bf75759c019b843afd4c6aeb694159
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ad2655de8289afa40aa520f9fc474681
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: db5350cd22f3a0f4f818a5f985342136
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,6 +1,8 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Escape_Room_Engine.Engine.Scripts.Modules; using Escape_Room_Engine.Engine.Scripts.Modules;
using Escape_Room_Engine.Engine.Scripts.Utilities;
using UnityEngine; using UnityEngine;
using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger; using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger;
using LogType = Escape_Room_Engine.Engine.Scripts.Utilities.LogType; 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 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; [Tooltip("The size of the physical play space available to the engine.")] public Vector2Int playSpace;
public ModuleDescription genericModule;
public DoorModuleDescription spawnDoor;
public List<DoorModuleDescription> exitDoorTypes;
private int NumberOfRooms => _rooms.Count; private int NumberOfRooms => _rooms.Count;
@@ -45,12 +50,13 @@ namespace Escape_Room_Engine.Engine.Scripts
Logger.Log("Generating room...", LogType.RoomGeneration); 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 // 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); var room = new Room(entrance);
_rooms.Add(room); _rooms.Add(room);
GenerateSpace(room, entrance); // TODO: rooms with more than one space GenerateSpace(room, entrance); // TODO: rooms with more than one space
room.InstantiateRoom(_playSpaceOrigin.transform, (_rooms.Count - 1).ToString()); room.InstantiateRoom(_playSpaceOrigin.transform, (_rooms.Count - 1).ToString());
} }
@@ -63,7 +69,7 @@ namespace Escape_Room_Engine.Engine.Scripts
var space = new Space(rrDimensions, entrance); var space = new Space(rrDimensions, entrance);
// add exit // add exit
var exitDoor = new DoorModule(DoorType.Exit, space); var exitDoor = new DoorModule(space, exitDoorTypes.RandomElement());
exitDoor.Place(new Vector2Int( exitDoor.Place(new Vector2Int(
Random.Range(0, rrDimensions.width), Random.Range(0, rrDimensions.width),
Random.Range(0, rrDimensions.length) Random.Range(0, rrDimensions.length)
@@ -86,7 +92,7 @@ namespace Escape_Room_Engine.Engine.Scripts
Math.Min(entranceRrPosition.x, playSpace.x - minRoomSize.x) Math.Min(entranceRrPosition.x, playSpace.x - minRoomSize.x)
); );
var xMax = Utilities.Utilities.RandomInclusive( var xMax = Utilities.Utilities.RandomInclusive(
Math.Max(entranceRrPosition.x, xMin + minRoomSize.x), Math.Max(entranceRrPosition.x + 1, xMin + minRoomSize.x),
playSpace.x playSpace.x
); );
var zMin = Utilities.Utilities.RandomInclusive( var zMin = Utilities.Utilities.RandomInclusive(
@@ -94,13 +100,13 @@ namespace Escape_Room_Engine.Engine.Scripts
Math.Min(entranceRrPosition.y, playSpace.y - minRoomSize.y) Math.Min(entranceRrPosition.y, playSpace.y - minRoomSize.y)
); );
var zMax = Utilities.Utilities.RandomInclusive( var zMax = Utilities.Utilities.RandomInclusive(
Math.Max(entranceRrPosition.y, zMin + minRoomSize.y), Math.Max(entranceRrPosition.y + 1, zMin + minRoomSize.y),
playSpace.y playSpace.y
); );
var dimensions = new Dimensions(xMax - xMin, zMax - zMin, xMin, zMin); 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; return dimensions;
} }
@@ -112,17 +118,5 @@ namespace Escape_Room_Engine.Engine.Scripts
_rooms[NumberOfRooms - 1].roomObject.SetActive(false); _rooms[NumberOfRooms - 1].roomObject.SetActive(false);
} }
} }
/// <summary>
/// Dispose of the oldest room to save resources.
/// </summary>
public void DisposeOldestRoom()
{
if (NumberOfRooms > 0)
{
_rooms[NumberOfRooms - 1].Destroy();
_rooms.RemoveAt(NumberOfRooms - 1);
}
}
} }
} }

View File

@@ -1,4 +1,5 @@
using UnityEngine; using System;
using UnityEngine;
namespace Escape_Room_Engine.Engine.Scripts.Modules namespace Escape_Room_Engine.Engine.Scripts.Modules
{ {
@@ -7,14 +8,15 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules
Entrance = ModuleType.DoorEntrance, Exit = ModuleType.DoorExit Entrance = ModuleType.DoorEntrance, Exit = ModuleType.DoorExit
} }
[Serializable]
public class DoorModule : Module public class DoorModule : Module
{ {
public bool IsEntrance => IsType((ModuleType)DoorType.Entrance); public bool IsEntrance => IsType((ModuleType)DoorType.Entrance);
public bool IsExit => IsType((ModuleType)DoorType.Exit); 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 srDimensions.Size = Vector2Int.one; // door always has size 1x1
} }

View File

@@ -0,0 +1,15 @@
using UnityEngine;
namespace Escape_Room_Engine.Engine.Scripts.Modules
{
[CreateAssetMenu(menuName = "Door Module")]
public class DoorModuleDescription : ModuleDescription
{
public DoorType doorType;
/// <summary>
/// The description for the door that should be connected with this one.
/// <example>If this is a teleporter entrance, the connected door should be a teleporter exit.</example>
/// </summary>
public DoorModuleDescription connectedDoorDescription;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f5c1202346c34ebc9c3f701a98b50877
timeCreated: 1667833660

View File

@@ -1,9 +1,10 @@
using System; using System;
using System.Collections.Generic; using System.Linq;
using Escape_Room_Engine.Engine.Scripts.Utilities; using Escape_Room_Engine.Engine.Scripts.Utilities;
using UnityEngine; using UnityEngine;
using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger; using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger;
using LogType = Escape_Room_Engine.Engine.Scripts.Utilities.LogType; using LogType = Escape_Room_Engine.Engine.Scripts.Utilities.LogType;
using Object = UnityEngine.Object;
namespace Escape_Room_Engine.Engine.Scripts.Modules namespace Escape_Room_Engine.Engine.Scripts.Modules
{ {
@@ -16,43 +17,43 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules
/// <summary> /// <summary>
/// Get the room relative (<i>RR</i>) position of this module. /// Get the room relative (<i>RR</i>) position of this module.
/// </summary> /// </summary>
internal Vector2Int RrPosition => space.ToRoomRelative(SrPosition); internal Vector2Int RrPosition => _space.ToRoomRelative(SrPosition);
internal readonly Space space;
internal readonly ModuleDescription _description;
protected GameObject _moduleObject; protected GameObject _moduleObject;
protected readonly List<ModuleType> types = new();
/// <summary> /// <summary>
/// The space relative (<i>SR</i>) dimensions of this module. /// The space relative (<i>SR</i>) dimensions of this module.
/// </summary> /// </summary>
protected Dimensions srDimensions; 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) internal bool IsType(ModuleType type)
{ {
return types.Contains(type); return _description.types.Contains(type);
} }
/// <summary> /// <summary>
/// Place this module with a position relative to the room. /// Place this module with a position relative to the room.
/// </summary> /// </summary>
/// <param name="rrPosition">The room relative (<i>RR</i>) position of this module. Must be inside the space dimensions.</param> /// <param name="rrPosition">The room relative (<i>RR</i>) position of this module. Must be inside the space dimensions.</param>
/// <exception cref="Exception">If the position is not inside the space dimensions.</exception> /// <exception cref="Exception">If the position is not inside the space dimensions.</exception>
internal void PlaceRoomRelative(Vector2Int rrPosition) => Place(space.ToSpaceRelative(rrPosition)); internal void PlaceRoomRelative(Vector2Int rrPosition) => Place(_space.ToSpaceRelative(rrPosition));
/// <summary> /// <summary>
/// Place this module with a position relative to the space it is in. /// Place this module with a position relative to the space it is in.
/// </summary> /// </summary>
/// <param name="srPosition">The space relative (<i>SR</i>) position of this module. Must be inside the space dimensions.</param> /// <param name="srPosition">The space relative (<i>SR</i>) position of this module. Must be inside the space dimensions.</param>
/// <exception cref="Exception">If the position is not inside the space dimensions.</exception> /// <exception cref="Exception">If the position is not inside the space dimensions.</exception>
internal void Place(Vector2Int srPosition) { 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; 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); 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() public override string ToString()
{ {
return $"Module ({string.Join(',', types.ConvertAll(type => type.ToString()))})"; return $"Module ({string.Join(',', _description.types.ToList().ConvertAll(type => type.ToString()))})";
} }
} }
} }

View File

@@ -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<ModuleType> types = new();
public GameObject modulePrefab;
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: abf4a405f6c64073995bded39977563e
timeCreated: 1667831630

View File

@@ -1,5 +1,4 @@
using System; using Escape_Room_Engine.Engine.Scripts.Modules;
using Escape_Room_Engine.Engine.Scripts.Modules;
using UnityEngine; using UnityEngine;
using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger; using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger;
using LogType = Escape_Room_Engine.Engine.Scripts.Utilities.LogType; using LogType = Escape_Room_Engine.Engine.Scripts.Utilities.LogType;
@@ -14,34 +13,35 @@ namespace Escape_Room_Engine.Engine.Scripts
/// </summary> /// </summary>
internal Vector2Int rrPosition; 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) internal void ConnectFrom(DoorModule door)
{ {
fromOut = door; fromOut = door;
rrPosition = fromOut.RrPosition; 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; toIn = door;
// to make sure the origin of the player doesn't move, the two doors must be placed in the same location // to make sure the origin of the player doesn't move, the two doors must be placed in the same location
toIn.PlaceRoomRelative(rrPosition); 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);
} }
} }
} }

View File

@@ -19,7 +19,8 @@ namespace Escape_Room_Engine.Engine.Scripts
this.rrDimensions = rrDimensions; this.rrDimensions = rrDimensions;
// connect the space to its passage // 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); AddModule(entrance.toIn);
} }
@@ -39,6 +40,9 @@ namespace Escape_Room_Engine.Engine.Scripts
var meshRenderer = _spaceObject.GetComponent<MeshRenderer>(); var meshRenderer = _spaceObject.GetComponent<MeshRenderer>();
meshRenderer.material = Engine.DefaultEngine.roomMaterial; meshRenderer.material = Engine.DefaultEngine.roomMaterial;
// instantiate all modules inside this space
_modules.ForEach(module => module.InstantiateModule(_spaceObject.transform));
} }
/// <summary> /// <summary>

View File

@@ -1,23 +0,0 @@
using Escape_Room_Engine.Engine.Scripts.Modules;
using UnityEngine;
namespace Escape_Room_Engine.Engine.Scripts
{
/// <summary>
/// A SpawnPassage is a type of passage used solely for entering the very fist space. It always places the entrance door at (0, 0).
/// </summary>
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);
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 0a168ccfeb4e46b9a2c04442afef6c4c
timeCreated: 1667813431

View File

@@ -1,4 +1,5 @@
using UnityEngine; using System.Collections.Generic;
using UnityEngine;
namespace Escape_Room_Engine.Engine.Scripts.Utilities namespace Escape_Room_Engine.Engine.Scripts.Utilities
{ {
@@ -6,8 +7,6 @@ namespace Escape_Room_Engine.Engine.Scripts.Utilities
{ {
#region Math #region Math
public static int RandomInclusive(int from, int to) => Random.Range(from, to + 1);
/// <summary> /// <summary>
/// Returns whether a position relative to some dimensions is inside those dimensions. /// Returns whether a position relative to some dimensions is inside those dimensions.
/// </summary> /// </summary>
@@ -19,5 +18,13 @@ namespace Escape_Room_Engine.Engine.Scripts.Utilities
} }
#endregion #endregion
#region Randomness
public static int RandomInclusive(int from, int to) => Random.Range(from, to + 1);
public static T RandomElement<T>(this List<T> list) => list[Random.Range(0, list.Count)];
#endregion
} }
} }

View File

@@ -1235,6 +1235,10 @@ MonoBehaviour:
roomMaterial: {fileID: 2100000, guid: 39e2ed014eda5d6408c16fbf0fa80781, type: 2} roomMaterial: {fileID: 2100000, guid: 39e2ed014eda5d6408c16fbf0fa80781, type: 2}
minRoomSize: {x: 3, y: 3} minRoomSize: {x: 3, y: 3}
playSpace: {x: 4, y: 6} 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 --- !u!4 &1568048335
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0