функция генерирования коридора
This commit is contained in:
1 parent
236fd9d9f6
commit
3a73877096
11 files changed
+332
-35
No files matched your search
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RiderProjectSettingsUpdater">
|
||||
<option name="singleClickDiffPreview" value="1" />
|
||||
<option name="unhandledExceptionsIgnoreList" value="1" />
|
||||
<option name="vcsConfiguration" value="3" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+6
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+30
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="5eff0d52-1501-4a90-b2fd-2f2b492e4169" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/Assets/New Material.mat" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Assets/New Material.mat.meta" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Assets/_Project/Scripts/LevelGenerating/WallsGenerator.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/_Project/Scripts/LevelGenerating/WallsGenerator.cs" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="INCOMING_COMMITS_CHECK_STRATEGY" value="FETCH" />
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"git-widget-placeholder": "main",
|
||||
"git.auto.fetch.suggestion.counter": "1"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="TaskManager">
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnityCheckinConfiguration" checkUnsavedScenes="true" />
|
||||
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
|
||||
</project>
|
||||
+173
-4
@@ -2623,14 +2623,14 @@ Light:
|
||||
m_Enabled: 1
|
||||
serializedVersion: 13
|
||||
m_Type: 1
|
||||
m_Color: {r: 0.8207547, g: 0, b: 0, a: 1}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Intensity: 0.78
|
||||
m_Range: 10
|
||||
m_SpotAngle: 30
|
||||
m_InnerSpotAngle: 21.802082
|
||||
m_CookieSize2D: {x: 10, y: 10}
|
||||
m_Shadows:
|
||||
m_Type: 2
|
||||
m_Type: 1
|
||||
m_Resolution: -1
|
||||
m_CustomResolution: -1
|
||||
m_Strength: 1
|
||||
@@ -2687,7 +2687,7 @@ Transform:
|
||||
m_GameObject: {fileID: 146683184}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalPosition: {x: 0, y: 3.58, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@@ -7990,6 +7990,118 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 1672666446545052606, guid: 51510de34f82041149d25090ec962e10, type: 3}
|
||||
m_PrefabInstance: {fileID: 432644123}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &441374198
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 441374199}
|
||||
- component: {fileID: 441374202}
|
||||
- component: {fileID: 441374201}
|
||||
- component: {fileID: 441374200}
|
||||
m_Layer: 0
|
||||
m_Name: Cube
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &441374199
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 441374198}
|
||||
serializedVersion: 2
|
||||
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: 552049569}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!65 &441374200
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 441374198}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &441374201
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 441374198}
|
||||
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_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 05c40618138553b3f9c385bda42bd974, 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_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &441374202
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 441374198}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1001 &442159163
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -10422,6 +10534,60 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 1672666446545052606, guid: 51510de34f82041149d25090ec962e10, type: 3}
|
||||
m_PrefabInstance: {fileID: 551062003}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &552049568
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 552049569}
|
||||
- component: {fileID: 552049570}
|
||||
m_Layer: 0
|
||||
m_Name: ConnectingRoom
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &552049569
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 552049568}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -2, y: 3, z: 1}
|
||||
m_LocalScale: {x: 4, y: 3, z: 5}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 441374199}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!65 &552049570
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 552049568}
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_IsTrigger: 0
|
||||
m_ProvidesContacts: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0.5, y: 0.5, z: 0.5}
|
||||
--- !u!1001 &556652617
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -13681,6 +13847,8 @@ MonoBehaviour:
|
||||
lengthWallMax: 0
|
||||
lengthStartRoom: 10
|
||||
lengthFloor: 100
|
||||
corridorLength: 5
|
||||
corridorWigth: 4
|
||||
GameObjectA: {fileID: 8066171868259172852, guid: e46748b8eb8a6074d9bb87701cebe84b, type: 3}
|
||||
GameObjectB: {fileID: 4641718306729093824, guid: 3905eab8a5f6b3049a83378b1acf1ebc, type: 3}
|
||||
--- !u!4 &740097205
|
||||
@@ -24305,7 +24473,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!114 &1269659452
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -44552,3 +44720,4 @@ SceneRoots:
|
||||
- {fileID: 11872312}
|
||||
- {fileID: 217181662}
|
||||
- {fileID: 740097205}
|
||||
- {fileID: 552049569}
|
||||
@@ -12,7 +12,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
|
||||
m_Name: Bloom
|
||||
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.Bloom
|
||||
active: 0
|
||||
active: 1
|
||||
skipIterations:
|
||||
m_OverrideState: 0
|
||||
m_Value: 1
|
||||
@@ -80,7 +80,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: ccf1aba9553839d41ae37dd52e9ebcce, type: 3}
|
||||
m_Name: MotionBlur
|
||||
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.MotionBlur
|
||||
active: 0
|
||||
active: 1
|
||||
mode:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
@@ -105,10 +105,10 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
|
||||
m_Name: Vignette
|
||||
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.Vignette
|
||||
active: 0
|
||||
active: 1
|
||||
color:
|
||||
m_OverrideState: 1
|
||||
m_Value: {r: 1, g: 0, b: 0, a: 1}
|
||||
m_Value: {r: 0, g: 0, b: 0, a: 1}
|
||||
center:
|
||||
m_OverrideState: 1
|
||||
m_Value: {x: 0.5, y: 0.5}
|
||||
@@ -133,7 +133,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
|
||||
m_Name: Tonemapping
|
||||
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.Tonemapping
|
||||
active: 0
|
||||
active: 1
|
||||
mode:
|
||||
m_OverrideState: 1
|
||||
m_Value: 1
|
||||
@@ -173,7 +173,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
|
||||
m_Name: ColorAdjustments
|
||||
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Runtime::UnityEngine.Rendering.Universal.ColorAdjustments
|
||||
active: 0
|
||||
active: 1
|
||||
postExposure:
|
||||
m_OverrideState: 1
|
||||
m_Value: 0.18
|
||||
|
||||
@@ -1,5 +1,18 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &-1320640688500226478
|
||||
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: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
|
||||
version: 10
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
@@ -7,7 +20,7 @@ Material:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: New Material
|
||||
m_Name: New Material 1
|
||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
@@ -15,8 +28,8 @@ Material:
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
m_DoubleSidedGI: 1
|
||||
m_CustomRenderQueue: 2000
|
||||
stringTagMap:
|
||||
RenderType: Opaque
|
||||
disabledShaderPasses:
|
||||
@@ -91,7 +104,7 @@ Material:
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cull: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
@@ -108,7 +121,7 @@ Material:
|
||||
- _ReceiveShadows: 1
|
||||
- _ScreenSpaceReflections: 1
|
||||
- _ScreenSpaceReflectionsContributeTransparent: 1
|
||||
- _Smoothness: 0.5
|
||||
- _Smoothness: 0.936
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
@@ -118,22 +131,9 @@ Material:
|
||||
- _XRMotionVectorsPass: 1
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0, g: 0.9248903, b: 1, a: 1}
|
||||
- _Color: {r: 0, g: 0.9248903, b: 1, a: 1}
|
||||
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _Color: {r: 1, g: 1, b: 1, 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: []
|
||||
m_AllowLocking: 1
|
||||
--- !u!114 &4052475867165565193
|
||||
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: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
|
||||
version: 10
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56b30cdacaf22092d8de30ad2434986c
|
||||
guid: 05c40618138553b3f9c385bda42bd974
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
@@ -10,7 +10,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
public static List<Room> Rooms = new List<Room>();
|
||||
[SerializeField] private readonly int curFloor;
|
||||
|
||||
void AddRoom(ref Room room)
|
||||
public void AddRoom(ref Room room)
|
||||
{
|
||||
Rooms.Add(room);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
public enum RoomType
|
||||
{
|
||||
Start,
|
||||
Corridor,
|
||||
Lift,
|
||||
Laboratory,
|
||||
Boss,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using System.ComponentModel.Design.Serialization;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
namespace _Project.Scripts.LevelGenerating
|
||||
{
|
||||
@@ -10,9 +12,13 @@ namespace _Project.Scripts.LevelGenerating
|
||||
[SerializeField] private int lengthWallMax;
|
||||
[SerializeField] private int lengthStartRoom;
|
||||
[SerializeField] private int lengthFloor;
|
||||
[SerializeField] private int corridorLength;
|
||||
[SerializeField] private int corridorWigth;
|
||||
[SerializeField] private GameObject GameObjectA;
|
||||
[SerializeField] private GameObject GameObjectB;
|
||||
|
||||
|
||||
|
||||
|
||||
private int RoomCount;
|
||||
private LevelManager levelManager;
|
||||
@@ -30,8 +36,76 @@ namespace _Project.Scripts.LevelGenerating
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateCorridor(Vector2 posRoom, int Length, int Wigth, ExitsInRoomType exitType)
|
||||
{
|
||||
Vector2 corridorPos = Vector2.zero;
|
||||
int cLength = 0;
|
||||
int cWidth = 0;
|
||||
|
||||
switch (exitType)
|
||||
{
|
||||
// Выход направо (+X)
|
||||
case ExitsInRoomType.XAxisP:
|
||||
// Начинается у правой стены комнаты (posRoom.x + Length)
|
||||
// Центрируем коридор по высоте/оси Z: смещаем на половину разницы ширин
|
||||
corridorPos = new Vector2(
|
||||
posRoom.x + Length,
|
||||
posRoom.y + (Wigth - corridorWigth) / 2f
|
||||
);
|
||||
cLength = corridorLength;
|
||||
cWidth = corridorWigth;
|
||||
break;
|
||||
|
||||
// Выход налево (-X)
|
||||
case ExitsInRoomType.XAxisN:
|
||||
// Начинается слева от комнаты, отступая на длину коридора
|
||||
corridorPos = new Vector2(
|
||||
posRoom.x - corridorLength,
|
||||
posRoom.y + (Wigth - corridorWigth) / 2f
|
||||
);
|
||||
cLength = corridorLength;
|
||||
cWidth = corridorWigth;
|
||||
break;
|
||||
|
||||
// Выход вперед/вверх (+Z / в Vector2 это Y)
|
||||
case ExitsInRoomType.ZAxisP:
|
||||
// Начинается у верхней стены комнаты (posRoom.y + Wigth)
|
||||
// Центрируем коридор по горизонтали/оси X:
|
||||
corridorPos = new Vector2(
|
||||
posRoom.x + (Length - corridorWigth) / 2f,
|
||||
posRoom.y + Wigth
|
||||
);
|
||||
// По оси X коридор узкий, по оси Z — длинный:
|
||||
cLength = corridorWigth;
|
||||
cWidth = corridorLength;
|
||||
break;
|
||||
|
||||
// Выход назад/вниз (-Z / в Vector2 это Y)
|
||||
case ExitsInRoomType.ZAxisN:
|
||||
// Начинается ниже комнаты, отступая на длину коридора
|
||||
corridorPos = new Vector2(
|
||||
posRoom.x + (Length - corridorWigth) / 2f,
|
||||
posRoom.y - corridorLength
|
||||
);
|
||||
cLength = corridorWigth;
|
||||
cWidth = corridorLength;
|
||||
break;
|
||||
}
|
||||
|
||||
// Создаем коридор как отдельную комнату
|
||||
// (Убедись, что в enum RoomType добавлен тип Corridor, либо используй Normal)
|
||||
Room corridor = new Room(cLength, cWidth, RoomType.Corridor);
|
||||
// Либо через твой конструктор с позицией:
|
||||
// Room corridor = new Room(corridorPos, cLength, cWidth, RoomType.Normal);
|
||||
|
||||
LevelManager.Rooms.Add(corridor);
|
||||
|
||||
// Визуализация коридора (расставляем маркеры по углам коридора для наглядности)
|
||||
Instantiate(GameObjectB, new Vector3(corridorPos.x, 0, corridorPos.y), Quaternion.identity);
|
||||
Instantiate(GameObjectB, new Vector3(corridorPos.x + cLength, 0, corridorPos.y), Quaternion.identity);
|
||||
Instantiate(GameObjectB, new Vector3(corridorPos.x + cLength, 0, corridorPos.y + cWidth), Quaternion.identity);
|
||||
Instantiate(GameObjectB, new Vector3(corridorPos.x, 0, corridorPos.y + cWidth), Quaternion.identity);
|
||||
}
|
||||
void CreateRoom()
|
||||
{
|
||||
int a = Random.Range(lengthWallMin, lengthWallMax);
|
||||
@@ -39,6 +113,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
Room room = new Room();
|
||||
room.Length = a;
|
||||
room.Wigth = b;
|
||||
|
||||
}
|
||||
|
||||
void CreateStartRoom()
|
||||
@@ -114,7 +189,7 @@ namespace _Project.Scripts.LevelGenerating
|
||||
Instantiate(GameObjectB, new Vector3(xR+lengthStartRoom,0,zR+lengthStartRoom), Quaternion.identity);
|
||||
Instantiate(GameObjectB, new Vector3(xR,0,zR+lengthStartRoom), Quaternion.identity);
|
||||
|
||||
|
||||
CreateCorridor(new Vector2Int(xR, zR),lengthStartRoom,lengthStartRoom,room.exits.First());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user