puzzle flow
This commit is contained in:
@@ -6,7 +6,7 @@ namespace Escape_Room_Engine.Engine.Scripts.Editor
|
||||
{
|
||||
public class EngineEditor : EditorWindow
|
||||
{
|
||||
private Button _generateRoomButton;
|
||||
private Button _generateRoomButton, _skipCurrentRoomButton;
|
||||
|
||||
[MenuItem("Window/Engine/Engine Editor")]
|
||||
public static void ShowEditor()
|
||||
@@ -21,9 +21,13 @@ namespace Escape_Room_Engine.Engine.Scripts.Editor
|
||||
{
|
||||
text = "Generate Room"
|
||||
};
|
||||
|
||||
rootVisualElement.Add(_generateRoomButton);
|
||||
|
||||
_skipCurrentRoomButton = new Button(SkipCurrentRoom)
|
||||
{
|
||||
text = "Skip Current Room"
|
||||
};
|
||||
rootVisualElement.Add(_skipCurrentRoomButton);
|
||||
|
||||
EditorApplication.playModeStateChanged += _ => UpdateUI();
|
||||
UpdateUI();
|
||||
}
|
||||
@@ -38,9 +42,19 @@ namespace Escape_Room_Engine.Engine.Scripts.Editor
|
||||
}
|
||||
}
|
||||
|
||||
private void SkipCurrentRoom()
|
||||
{
|
||||
if (EditorApplication.isPlaying)
|
||||
{
|
||||
Engine.DefaultEngine.CurrentRoom.Match(some: room => room.SkipRoom());
|
||||
UpdateUI();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateUI()
|
||||
{
|
||||
_generateRoomButton.SetEnabled(EditorApplication.isPlaying);
|
||||
_skipCurrentRoomButton.SetEnabled(EditorApplication.isPlaying && Engine.DefaultEngine.NumberOfRooms > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user