move puzzle implementations out of engine

This commit is contained in:
2023-03-22 09:44:17 +01:00
parent e1bfecbd4b
commit 30d8f986df
70 changed files with 82 additions and 46 deletions

View File

@@ -0,0 +1,17 @@
using UnityEngine;
namespace EscapeRoomEngine.Engine.Runtime.Modules.Description
{
/// <summary>
/// The <see cref="ModuleDescription"/> for a <see cref="DoorModule"/>. Includes the description of the connected door.
/// </summary>
[CreateAssetMenu(menuName = "Modules/Door")]
public class DoorModuleDescription : ModuleDescription
{
/// <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

@@ -0,0 +1,28 @@
using System.Collections.Generic;
using EscapeRoomEngine.Engine.Runtime.Modules.State;
using EscapeRoomEngine.Engine.Runtime.Requirements;
using NaughtyAttributes;
using UnityEngine;
namespace EscapeRoomEngine.Engine.Runtime.Modules.Description
{
/// <summary>
/// The description of a specific module variant. Includes any requirements, the types and the module state that should be initialised with the module.
/// </summary>
[CreateAssetMenu(menuName = "Modules/Generic Module")]
public class ModuleDescription : ScriptableObject
{
[Tooltip("The module types decide how this module can be used.")]
public List<ModuleType> types = new();
public ModuleState modulePrefab;
[BoxGroup("Requirements")]
public List<PreconditionRequirement> preconditionRequirements = new();
[BoxGroup("Requirements")]
public List<PlacementRequirement> placementRequirements = new();
internal bool HasType(ModuleType type)
{
return types.Contains(type);
}
}
}

View File

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

View File

@@ -0,0 +1,28 @@
using NaughtyAttributes;
using UnityEngine;
namespace EscapeRoomEngine.Engine.Runtime.Modules.Description
{
/// <summary>
/// The <see cref="ModuleDescription"/> for a <see cref="DoorModule"/>. Includes the description of the connected door.
/// </summary>
[CreateAssetMenu(menuName = "Modules/Puzzle")]
public class PuzzleModuleDescription : ModuleDescription
{
[Tooltip("Each puzzle has a name that will be used to display it to the game master.")]
[InfoBox("Changes to the name or version of the puzzle change its ID, which means it will not be connected with any of its previous measures any more.", EInfoBoxType.Warning)]
public string puzzleName;
[InfoBox("Puzzle measurements will only be combined for the same puzzle with the same version. If large changes are made to the puzzle that might influence its measurements, the version should be incremented.")]
public int puzzleVersion = 1;
/// <summary>
/// The ID of the puzzle is used in the database.
/// </summary>
public int Id => puzzleName.GetHashCode() + puzzleVersion;
public override string ToString()
{
return $"{puzzleName} v{puzzleVersion} ({Id})";
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f928b97941e3469a9015316bb5ac1309
timeCreated: 1667873701