editor transport camera between rooms
This commit is contained in:
@@ -11,7 +11,13 @@ namespace EscapeRoomEngine.Engine.Runtime.Editor
|
||||
public class EngineEditor : EditorWindow
|
||||
{
|
||||
private bool _registeredUpdateEvent;
|
||||
private Button _passToNextRoomButton, _skipCurrentRoomButton, _skipAndPassButton;
|
||||
|
||||
private Button
|
||||
_passToNextRoomButton,
|
||||
_skipCurrentRoomButton,
|
||||
_skipAndPassButton,
|
||||
_cameraUpButton,
|
||||
_cameraDownButton;
|
||||
|
||||
[MenuItem("Window/Engine Editor")]
|
||||
public static void ShowEditor()
|
||||
@@ -37,6 +43,16 @@ namespace EscapeRoomEngine.Engine.Runtime.Editor
|
||||
text = "Skip Current And Pass To Next Room"
|
||||
};
|
||||
rootVisualElement.Add(_skipAndPassButton);
|
||||
_cameraUpButton = new Button(CameraUp)
|
||||
{
|
||||
text = "Camera ↑"
|
||||
};
|
||||
rootVisualElement.Add(_cameraUpButton);
|
||||
_cameraDownButton = new Button(CameraDown)
|
||||
{
|
||||
text = "Camera ↓"
|
||||
};
|
||||
rootVisualElement.Add(_cameraDownButton);
|
||||
|
||||
EditorApplication.playModeStateChanged += _ => 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()
|
||||
{
|
||||
if (Engine.Instance && EditorApplication.isPlaying)
|
||||
|
||||
Reference in New Issue
Block a user