using Godot;
namespace BITKit;
///
/// 虚拟相机接口定义
///
public interface IVirtualCamera:IActivable
{
///
/// 相机的FOV
///
int FOV { get; }
///
/// 相机是否已启用
///
bool IsEnabled { get; }
///
/// 相机坐标
///
Vector3 Position { get; }
///
/// 相机旋转
///
Vector3 Rotation { get; }
}
///
/// 基于Node3D的包括基础功能的虚拟相机
///
public partial class VirtualCamera : Node3D, IVirtualCamera
{
[Export] private int fov;
[Export] private bool isEnabled;
public int FOV => fov;
public bool IsEnabled => isEnabled;
Vector3 IVirtualCamera.Position => GlobalPosition;
Vector3 IVirtualCamera.Rotation => Rotation;
public void SetActive(bool active)
{
isEnabled = active;
}
public override void _Ready()
{
CameraService.Register(this);
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
CameraService.UnRegister(this);
}
}
}