68 lines
1.5 KiB
C#
68 lines
1.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
namespace NBF
|
|
{
|
|
public enum CameraUpdateMode
|
|
{
|
|
Smooth,
|
|
Immediate,
|
|
}
|
|
|
|
public enum CameraMode
|
|
{
|
|
Third,
|
|
Free,
|
|
}
|
|
|
|
[Serializable]
|
|
public class CameraCfg
|
|
{
|
|
public CameraMode Mode;
|
|
public CameraUpdateMode UpdateMode;
|
|
|
|
public float SmoothTime;
|
|
|
|
public float NearClipPlane = 1;
|
|
public float FarClipPlane = 500;
|
|
|
|
public Vector3 Near;
|
|
public Vector3 Far;
|
|
public float BestRatio = 0.5f;
|
|
|
|
public Vector3 Distance
|
|
{
|
|
get { return this.Far - this.Near; }
|
|
}
|
|
|
|
public Vector3 Best
|
|
{
|
|
get
|
|
{
|
|
switch (Mode)
|
|
{
|
|
case CameraMode.Third:
|
|
return this.Near + (this.Far - this.Near) * this.BestRatio;
|
|
default:
|
|
return Quaternion.Euler(this.PitchBest, 0, 0) *
|
|
(Vector3.back * (this.Near + (this.Far - this.Near) * this.BestRatio).magnitude);
|
|
}
|
|
}
|
|
}
|
|
|
|
public float Yaw;
|
|
public bool YawAtThird;
|
|
|
|
public float PitchBest;
|
|
public float PitchMin;
|
|
public float PitchMax;
|
|
}
|
|
|
|
[CreateAssetMenu(menuName = "ET/CreateCameraConfig", fileName = "CameraCfg", order = 1)]
|
|
public class CameraScriptObject : ScriptableObject
|
|
{
|
|
public float ScaleTime = 6;
|
|
public CameraCfg ThirdCfg;
|
|
public CameraCfg FreeCfg;
|
|
}
|
|
} |