36 lines
992 B
C#
36 lines
992 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Artngame.LUMINA;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
namespace Net.Like.Xue.Tokyo
|
|
{
|
|
public class LuminaSetupController : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private LUMINA lumina;
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (!lumina.sun)
|
|
{
|
|
for (var i = 0; i < SceneManager.sceneCount; i++)
|
|
{
|
|
var scene = SceneManager.GetSceneAt(i);
|
|
|
|
foreach (var rootGameObject in scene.GetRootGameObjects())
|
|
{
|
|
if(rootGameObject.TryGetComponent<Light>(out var rootLight) is false)continue;
|
|
if(rootLight.type is not LightType.Directional)continue;
|
|
|
|
lumina.sun = rootLight;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|