98 lines
1.9 KiB
C#
98 lines
1.9 KiB
C#
using Enviro;
|
|
using NBF;
|
|
using UnityEngine;
|
|
using UnityEngine.AzureSky;
|
|
using WaveHarmonic.Crest;
|
|
|
|
public class SceneSettings : MonoBehaviour
|
|
{
|
|
public static SceneSettings Instance;
|
|
|
|
public int sceneID;
|
|
|
|
public string sceneName = "";
|
|
|
|
public Transform WaterObject;
|
|
|
|
public Transform Node;
|
|
|
|
public Transform GearNode;
|
|
|
|
public WaterRenderer Water;
|
|
|
|
// public ObiUpdater obiFixedUpdater;
|
|
|
|
public LineRenderer LineRenderer;
|
|
|
|
public AzureCoreSystem AzureCoreSystem;
|
|
|
|
public int FPS;
|
|
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
if (Node == null)
|
|
{
|
|
Node = transform;
|
|
}
|
|
|
|
if (GearNode == null)
|
|
{
|
|
GearNode = Node;
|
|
}
|
|
|
|
// obiFixedUpdater = FindFirstObjectByType<ObiLateFixedUpdater>();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
// EnviroManager.instance.Time.Settings.simulate = true;
|
|
// EnviroManager.instance.Time.SetTimeOfDay(0.5f * 24f);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
UpdateFPS();
|
|
UpdateTimeOfDay();
|
|
}
|
|
|
|
|
|
#region FPS
|
|
|
|
public float updateInterval = 0.2f; // 更新间隔(秒)
|
|
|
|
private float accum = 0;
|
|
private int frames = 0;
|
|
private float timeleft;
|
|
|
|
void UpdateFPS()
|
|
{
|
|
timeleft -= Time.deltaTime;
|
|
accum += Time.timeScale / Time.deltaTime;
|
|
frames++;
|
|
|
|
if (timeleft <= 0.0f)
|
|
{
|
|
FPS = (int)(accum / frames);
|
|
|
|
timeleft = updateInterval;
|
|
accum = 0.0f;
|
|
frames = 0;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 场景时间
|
|
|
|
private void UpdateTimeOfDay()
|
|
{
|
|
var p = GameTimer.GetGameDayProgress();
|
|
Debug.Log(p);
|
|
// EnviroManager.instance.Time.SetTimeOfDay(GameTimer.GetGameDayProgress() * 24f);
|
|
if(AzureCoreSystem)
|
|
AzureCoreSystem.timeSystem.timeline = 24F * p;
|
|
}
|
|
|
|
#endregion
|
|
} |