2025-12-12 15:19:10 +08:00
|
|
|
using Convention;
|
|
|
|
|
using Demo.Attr;
|
2025-09-25 19:04:05 +08:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Demo.Game
|
|
|
|
|
{
|
2025-12-12 15:19:10 +08:00
|
|
|
[Scriptable]
|
2025-09-25 19:04:05 +08:00
|
|
|
public class WorldLightObject : ScriptableObject
|
|
|
|
|
{
|
|
|
|
|
public static WorldLightObject Make()
|
|
|
|
|
{
|
|
|
|
|
return new GameObject().AddComponent<WorldLightObject>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Content, SerializeField] private Vector3 LastPosition = Vector3.zero;
|
|
|
|
|
[Content, SerializeField] private Quaternion LastRotation = Quaternion.identity;
|
|
|
|
|
|
2025-11-25 10:52:39 +08:00
|
|
|
public override void ResetEnterGameStatus()
|
2025-09-25 19:04:05 +08:00
|
|
|
{
|
2025-11-25 10:52:39 +08:00
|
|
|
base.ResetEnterGameStatus();
|
2025-09-25 19:04:05 +08:00
|
|
|
var light = GetRoot().RootGameController.GlobalLight;
|
|
|
|
|
LastPosition = light.localPosition;
|
|
|
|
|
LastRotation = light.localRotation;
|
|
|
|
|
light.SetParent(transform);
|
|
|
|
|
light.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override IEnumerator UnloadScript()
|
|
|
|
|
{
|
|
|
|
|
var light = GetRoot().RootGameController.GlobalLight;
|
|
|
|
|
light.SetParent(GetRoot().RootGameController.transform);
|
|
|
|
|
light.SetPositionAndRotation(LastPosition, LastRotation);
|
|
|
|
|
yield return base.UnloadScript();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|