调整目录结构
This commit is contained in:
92
Assets/Scripts/Demo/SceneSettings.cs
Normal file
92
Assets/Scripts/Demo/SceneSettings.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using Enviro;
|
||||
using NBF;
|
||||
using Obi;
|
||||
using UnityEngine;
|
||||
|
||||
public class SceneSettings : MonoBehaviour
|
||||
{
|
||||
public static SceneSettings Instance;
|
||||
|
||||
public int sceneID;
|
||||
|
||||
public string sceneName = "";
|
||||
|
||||
public Transform WaterObject;
|
||||
|
||||
public Transform Node;
|
||||
|
||||
public Transform GearNode;
|
||||
|
||||
public ObiLateFixedUpdater obiFixedUpdater;
|
||||
|
||||
public LineRenderer LineRenderer;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user