make sure every module is accessible
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Escape_Room_Engine.Engine.Scripts.Modules;
|
||||
using Escape_Room_Engine.Engine.Scripts.Utilities;
|
||||
using NaughtyAttributes;
|
||||
using UnityEngine;
|
||||
using Logger = Escape_Room_Engine.Engine.Scripts.Utilities.Logger;
|
||||
using LogType = Escape_Room_Engine.Engine.Scripts.Utilities.LogType;
|
||||
@@ -23,16 +24,31 @@ namespace Escape_Room_Engine.Engine.Scripts
|
||||
}
|
||||
}
|
||||
private static Engine _foundEngine;
|
||||
|
||||
[BoxGroup("Size")]
|
||||
[Tooltip("The minimum size that should be allowed for rooms.")]
|
||||
public Vector2Int minRoomSize;
|
||||
|
||||
[BoxGroup("Size")]
|
||||
[Tooltip("The size of the physical play space available to the engine.")]
|
||||
public Vector2Int playSpace;
|
||||
|
||||
[BoxGroup("Doors")]
|
||||
[Required]
|
||||
public DoorModuleDescription spawnDoor;
|
||||
|
||||
[BoxGroup("Doors")]
|
||||
[ValidateInput("IsNotEmpty", "At least one exit door type is required")]
|
||||
public List<DoorModuleDescription> exitDoorTypes;
|
||||
|
||||
[BoxGroup("Puzzles")]
|
||||
[MinMaxSlider(0, 10)] public Vector2Int puzzleCount;
|
||||
|
||||
[BoxGroup("Puzzles")]
|
||||
public List<PuzzleModuleDescription> puzzleTypes;
|
||||
|
||||
public Material roomMaterial;
|
||||
|
||||
[Range(0, 10)] public int minPuzzleCount, maxPuzzleCount;
|
||||
[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<DoorModuleDescription> exitDoorTypes;
|
||||
public List<PuzzleModuleDescription> puzzleTypes;
|
||||
|
||||
private int NumberOfRooms => _rooms.Count;
|
||||
|
||||
@@ -75,7 +91,7 @@ namespace Escape_Room_Engine.Engine.Scripts
|
||||
var exit = new Passage(exitDoor);
|
||||
|
||||
// add puzzles
|
||||
for (var i = 0; i < Utilities.Utilities.RandomInclusive(minPuzzleCount, maxPuzzleCount); i++)
|
||||
for (var i = 0; i < Utilities.Utilities.RandomInclusive(puzzleCount.x, puzzleCount.y); i++)
|
||||
{
|
||||
space.AddModuleWithRequirements(new PuzzleModule(space, puzzleTypes.RandomElement()));
|
||||
}
|
||||
@@ -90,5 +106,9 @@ namespace Escape_Room_Engine.Engine.Scripts
|
||||
_rooms[NumberOfRooms - 1].roomObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable once SuggestBaseTypeForParameter
|
||||
// ReSharper disable once UnusedMember.Local
|
||||
private bool IsNotEmpty(List<DoorModuleDescription> modules) => modules.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user