editor transport camera between rooms

This commit is contained in:
2023-05-14 18:33:14 +02:00
parent eba953b844
commit e2699061da

View File

@@ -11,7 +11,13 @@ namespace EscapeRoomEngine.Engine.Runtime.Editor
public class EngineEditor : EditorWindow public class EngineEditor : EditorWindow
{ {
private bool _registeredUpdateEvent; private bool _registeredUpdateEvent;
private Button _passToNextRoomButton, _skipCurrentRoomButton, _skipAndPassButton;
private Button
_passToNextRoomButton,
_skipCurrentRoomButton,
_skipAndPassButton,
_cameraUpButton,
_cameraDownButton;
[MenuItem("Window/Engine Editor")] [MenuItem("Window/Engine Editor")]
public static void ShowEditor() public static void ShowEditor()
@@ -37,6 +43,16 @@ namespace EscapeRoomEngine.Engine.Runtime.Editor
text = "Skip Current And Pass To Next Room" text = "Skip Current And Pass To Next Room"
}; };
rootVisualElement.Add(_skipAndPassButton); rootVisualElement.Add(_skipAndPassButton);
_cameraUpButton = new Button(CameraUp)
{
text = "Camera ↑"
};
rootVisualElement.Add(_cameraUpButton);
_cameraDownButton = new Button(CameraDown)
{
text = "Camera ↓"
};
rootVisualElement.Add(_cameraDownButton);
EditorApplication.playModeStateChanged += _ => UpdateUI(); EditorApplication.playModeStateChanged += _ => UpdateUI();
UpdateUI(); UpdateUI();
@@ -70,6 +86,16 @@ namespace EscapeRoomEngine.Engine.Runtime.Editor
} }
} }
private void CameraUp()
{
SceneView.lastActiveSceneView.pivot += new Vector3(0, 1000, 0);
}
private void CameraDown()
{
SceneView.lastActiveSceneView.pivot += new Vector3(0, -1000, 0);
}
private void UpdateUI() private void UpdateUI()
{ {
if (Engine.Instance && EditorApplication.isPlaying) if (Engine.Instance && EditorApplication.isPlaying)