新增volume更新器
This commit is contained in:
40
Assets/Scripts/Volume/VolumeObject.cs
Normal file
40
Assets/Scripts/Volume/VolumeObject.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Convention;
|
||||
using Demo.Attr;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Demo.Game
|
||||
{
|
||||
[Scriptable]
|
||||
public class VolumeObject : BaseVolume, IAssetBundleLoader
|
||||
{
|
||||
public static VolumeObject Make()
|
||||
{
|
||||
return new GameObject().AddComponent<VolumeObject>();
|
||||
}
|
||||
|
||||
[Content, SerializeField] private bool IsLoading = false;
|
||||
|
||||
protected override IEnumerator DoSomethingDuringApplyScript()
|
||||
{
|
||||
yield return base.DoSomethingDuringApplyScript();
|
||||
yield return new WaitUntil(() => !IsLoading);
|
||||
if (MyVolume.profile == null)
|
||||
{
|
||||
MyVolume.profile = Resources.Load<VolumeProfile>("Volume/Default");
|
||||
}
|
||||
}
|
||||
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void Load(string ab, string profile)
|
||||
{
|
||||
IsLoading = true;
|
||||
ConventionUtility.StartCoroutine(this.LoadAssetBundle(ab, x =>
|
||||
{
|
||||
MyVolume.profile = x.LoadAsset<VolumeProfile>(profile);
|
||||
IsLoading = false;
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user