54 lines
2.0 KiB
C#
54 lines
2.0 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni.RhythmGame;
|
|
using Ichni.RhythmGame.Beatmap;
|
|
using UnityEngine;
|
|
|
|
namespace Ichni.Editor
|
|
{
|
|
public class SceneCamera : MonoBehaviour, IBaseElement
|
|
{
|
|
public Camera camera;
|
|
|
|
public GameCamera.CameraViewType viewType;
|
|
public float perspectiveAngle;
|
|
public float orthographicSize;
|
|
|
|
public BaseElement_BM matchedBM { get; set; }
|
|
|
|
public void SetUpInspector()
|
|
{
|
|
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
|
var container = inspector.GenerateContainer("Scene Camera");
|
|
var viewTypeDropdown = inspector.GenerateDropdown(this, container, "View Type", typeof(GameCamera.CameraViewType), nameof(viewType));
|
|
var perspectiveAngleField = inspector.GenerateParameterInputField(this, container, "Perspective Angle", nameof(perspectiveAngle));
|
|
var orthographicSizeField = inspector.GenerateParameterInputField(this, container, "Orthographic Size", nameof(orthographicSize));
|
|
|
|
viewTypeDropdown.AddListenerFunction(_ =>
|
|
{
|
|
camera.orthographic = viewType == GameCamera.CameraViewType.Orthographic;
|
|
});
|
|
|
|
perspectiveAngleField.AddListenerFunction(_ =>
|
|
{
|
|
camera.fieldOfView = perspectiveAngle;
|
|
});
|
|
|
|
orthographicSizeField.AddListenerFunction(_ =>
|
|
{
|
|
camera.orthographicSize = orthographicSize;
|
|
});
|
|
|
|
string GetPosition() => $"Position: {camera.transform.position}";
|
|
var positionText = inspector.GenerateHintText(this, container, GetPosition);
|
|
string GetEulerAngles() => $"Euler Angles: {camera.transform.eulerAngles}";
|
|
var eulerAnglesText = inspector.GenerateHintText(this, container, GetEulerAngles);
|
|
}
|
|
|
|
public void MoveCamera(Vector3 delta)
|
|
{
|
|
camera.transform.position += delta;
|
|
}
|
|
}
|
|
} |