make sure every module is accessible
This commit is contained in:
@@ -74,6 +74,24 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules
|
||||
Logger.Log($"{this} has been placed at {srPosition} (SR)", LogType.ModulePlacement);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a position relative to this module to one relative to its space.
|
||||
/// <example>The module relative position <c>(0, 1)</c> should always be in front of the module, wherever it faces.</example>
|
||||
/// </summary>
|
||||
/// <param name="mrPosition">The module relative (<i>MR</i>) position that should be converted to a space relative (<i>SR</i>) position.</param>
|
||||
/// <returns></returns>
|
||||
internal Vector2Int ToSpaceRelative(Vector2Int mrPosition)
|
||||
{
|
||||
return srDimensions.Position + orientation switch
|
||||
{
|
||||
Orientation.North => mrPosition,
|
||||
Orientation.East => new Vector2Int(mrPosition.y, -mrPosition.x),
|
||||
Orientation.South => -mrPosition,
|
||||
Orientation.West => new Vector2Int(-mrPosition.y, mrPosition.x),
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
};
|
||||
}
|
||||
|
||||
internal void InstantiateModule(Transform parent)
|
||||
{
|
||||
_moduleObject = new GameObject(ToString());
|
||||
|
||||
Reference in New Issue
Block a user