puzzle module framework, puzzle a ball module
This commit is contained in:
@@ -39,9 +39,7 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules
|
||||
/// </summary>
|
||||
protected Dimensions srDimensions;
|
||||
|
||||
protected GameObject moduleObject;
|
||||
protected readonly Space space;
|
||||
private GameObject _orientationObject;
|
||||
|
||||
internal Module(Space space, ModuleDescription description)
|
||||
{
|
||||
@@ -96,21 +94,12 @@ namespace Escape_Room_Engine.Engine.Scripts.Modules
|
||||
|
||||
internal virtual void InstantiateModule(Transform parent)
|
||||
{
|
||||
moduleObject = new GameObject(ToString());
|
||||
moduleObject.transform.SetParent(parent, false);
|
||||
moduleObject.transform.localPosition = new Vector3(srDimensions.x + .5f, 0, srDimensions.z + .5f);
|
||||
AddStateComponent();
|
||||
|
||||
_orientationObject = new GameObject("Orientation");
|
||||
_orientationObject.transform.SetParent(moduleObject.transform, false);
|
||||
_orientationObject.transform.Rotate(Vector3.up, (float)orientation);
|
||||
|
||||
Object.Instantiate(description.modulePrefab, _orientationObject.transform, false);
|
||||
}
|
||||
|
||||
protected virtual void AddStateComponent()
|
||||
{
|
||||
State = moduleObject.AddComponent<ModuleState>();
|
||||
Logger.Log($"Instantiating {this}", LogType.RoomGeneration);
|
||||
|
||||
State = Object.Instantiate(description.modulePrefab, parent, false);
|
||||
State.transform.localPosition = new Vector3(srDimensions.x + .5f, 0, srDimensions.z + .5f);
|
||||
State.transform.Rotate(Vector3.up, (float)orientation);
|
||||
State.name = ToString();
|
||||
State.SetModule(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user