set placement size immediately on module creation

This commit is contained in:
2022-11-24 19:29:12 +01:00
parent a97f2a6c5d
commit 74fd757d20

View File

@@ -15,6 +15,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules
public readonly List<Module> relatedModules = new(); public readonly List<Module> relatedModules = new();
public ModuleState State { get; private set; } public ModuleState State { get; private set; }
internal Vector2Int Size => srPlacement.size;
internal Orientation Orientation => srPlacement.orientation; internal Orientation Orientation => srPlacement.orientation;
/// <summary> /// <summary>
/// Get the space relative (<i>SR</i>) position of this module. /// Get the space relative (<i>SR</i>) position of this module.
@@ -38,6 +39,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules
{ {
this.space = space; this.space = space;
this.description = description; this.description = description;
srPlacement.size = description.modulePrefab.size;
} }
internal bool IsType(ModuleType type) internal bool IsType(ModuleType type)
@@ -61,7 +63,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules
Place(new Placement Place(new Placement
{ {
position = space.ToSpaceRelative(rrPosition), position = space.ToSpaceRelative(rrPosition),
size = description.modulePrefab.size, size = srPlacement.size,
orientation = orientation orientation = orientation
}); });