make ModuleState abstract to avoid trouble with the type of reference to its Module

This commit is contained in:
2022-11-21 11:36:32 +01:00
parent b0df3f303a
commit d3abb8569c
4 changed files with 4 additions and 19 deletions

View File

@@ -92,7 +92,6 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 7860513085978939562} - component: {fileID: 7860513085978939562}
- component: {fileID: 4604142456167599783}
m_Layer: 0 m_Layer: 0
m_Name: Generic Module m_Name: Generic Module
m_TagString: Untagged m_TagString: Untagged
@@ -116,18 +115,6 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4604142456167599783
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3864228228344123331}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: efdc32c450f7411385748449459a17b4, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &4439105426094897912 --- !u!1 &4439105426094897912
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -15,7 +15,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules
{ {
public event DoorEventHandler DoorEvent; public event DoorEventHandler DoorEvent;
private new DoorModule Module { get; set; } private DoorModule Module { get; set; }
public bool Unlocked public bool Unlocked
{ {
get => _unlocked; get => _unlocked;

View File

@@ -2,10 +2,8 @@
namespace EscapeRoomEngine.Engine.Runtime.Modules namespace EscapeRoomEngine.Engine.Runtime.Modules
{ {
public class ModuleState : MonoBehaviour public abstract class ModuleState : MonoBehaviour
{ {
public Module Module { get; protected set; } public abstract void SetModule(Module module);
public virtual void SetModule(Module module) => Module = module;
} }
} }

View File

@@ -33,7 +33,7 @@ namespace EscapeRoomEngine.Engine.Runtime.Modules
public event PuzzleEventHandler PuzzleEvent; public event PuzzleEventHandler PuzzleEvent;
public EngineTheme theme; public EngineTheme theme;
private new PuzzleModule Module { get; set; } protected PuzzleModule Module { get; private set; }
public bool Solved public bool Solved
{ {
get => _solved; get => _solved;