39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using UnityEngine;
|
|
|
|
namespace Stary.Evo.InformationSave
|
|
{
|
|
public class CameraInfo : AbstractInformation<CameraInfo.Information>
|
|
{
|
|
public override void Save(int index)
|
|
{
|
|
var c = GetComponent<Camera>();
|
|
var tf = transform;
|
|
_list[index].position = tf.position.GetVector3Data();
|
|
_list[index].eulerAngles = tf.eulerAngles.GetVector3Data();
|
|
_list[index].orthographic = c.orthographic;
|
|
_list[index].orthographicSize = c.orthographicSize;
|
|
_list[index].fieldofView = c.fieldOfView;
|
|
}
|
|
|
|
public override void Switch(int index)
|
|
{
|
|
var c = GetComponent<Camera>();
|
|
var tf = transform;
|
|
tf.position = _list[index].position.SetVector3Data();
|
|
tf.eulerAngles = _list[index].eulerAngles.SetVector3Data();
|
|
c.orthographic = _list[index].orthographic;
|
|
c.orthographicSize = _list[index].orthographicSize;
|
|
c.fieldOfView = _list[index].fieldofView;
|
|
}
|
|
|
|
[System.Serializable]
|
|
public sealed class Information : InformationBase
|
|
{
|
|
public Vector3Data position;
|
|
public Vector3Data eulerAngles;
|
|
public bool orthographic;
|
|
public float orthographicSize;
|
|
public float fieldofView;
|
|
}
|
|
}
|
|
} |