generic puzzle module
This commit is contained in:
@@ -27,11 +27,13 @@ namespace Escape_Room_Engine.Engine.Scripts
|
||||
|
||||
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;
|
||||
|
||||
@@ -77,6 +79,17 @@ namespace Escape_Room_Engine.Engine.Scripts
|
||||
var exit = new Passage(exitDoor);
|
||||
space.AddModule(exitDoor);
|
||||
|
||||
// add puzzles
|
||||
for (var i = 0; i < Utilities.Utilities.RandomInclusive(minPuzzleCount, maxPuzzleCount); i++)
|
||||
{
|
||||
var puzzle = new PuzzleModule(space, puzzleTypes.RandomElement());
|
||||
puzzle.Place(new Vector2Int(
|
||||
Random.Range(0, rrDimensions.width),
|
||||
Random.Range(0, rrDimensions.length)
|
||||
));
|
||||
space.AddModule(puzzle);
|
||||
}
|
||||
|
||||
room.AddSpace(space, exit);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Escape_Room_Engine.Engine.Scripts.Modules
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Door Module")]
|
||||
[CreateAssetMenu(menuName = "Modules/Door")]
|
||||
public class DoorModuleDescription : ModuleDescription
|
||||
{
|
||||
public DoorType doorType;
|
||||
|
||||
@@ -3,7 +3,7 @@ using UnityEngine;
|
||||
|
||||
namespace Escape_Room_Engine.Engine.Scripts.Modules
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Generic Module")]
|
||||
[CreateAssetMenu(menuName = "Modules/Generic Module")]
|
||||
public class ModuleDescription : ScriptableObject
|
||||
{
|
||||
public readonly HashSet<ModuleType> types = new();
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
public enum ModuleType
|
||||
{
|
||||
DoorEntrance, DoorExit, // door types
|
||||
Puzzle,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Escape_Room_Engine.Engine.Scripts.Modules
|
||||
{
|
||||
public class PuzzleModule : Module
|
||||
{
|
||||
internal PuzzleModule(Space space, PuzzleModuleDescription description) : base(space, description)
|
||||
{
|
||||
_description.types.Add(ModuleType.Puzzle);
|
||||
srDimensions.Size = Vector2Int.one; // TODO: larger modules
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed86ddbc20ae479895ab3c538ea9226f
|
||||
timeCreated: 1667873701
|
||||
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Escape_Room_Engine.Engine.Scripts.Modules
|
||||
{
|
||||
[CreateAssetMenu(menuName = "Modules/Puzzle")]
|
||||
public class PuzzleModuleDescription : ModuleDescription
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f928b97941e3469a9015316bb5ac1309
|
||||
timeCreated: 1667873701
|
||||
Reference in New Issue
Block a user