新增volume更新器
This commit is contained in:
48
Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs
Normal file
48
Assets/Scripts/Volume/Updatement/BaseVolumeUpdatement.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Convention;
|
||||
using Demo.Attr;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Demo.Game
|
||||
{
|
||||
public abstract class BaseVolumeUpdatement<T> : Updatement<T> where T : unmanaged
|
||||
{
|
||||
[Content, SerializeField] private BaseVolume target;
|
||||
[Content, SerializeField] private string updateOverride;
|
||||
[Content, SerializeField] private string updateField;
|
||||
|
||||
protected override IEnumerator DoSomethingDuringApplyScript()
|
||||
{
|
||||
yield return base.DoSomethingDuringApplyScript();
|
||||
if (target == null)
|
||||
{
|
||||
target = this.UpdateTarget.SeekComponent<BaseVolume>();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateData(T data)
|
||||
{
|
||||
target.TrySetOverrideField<T>(updateOverride, updateField, data);
|
||||
}
|
||||
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void SetUpdateOverrideAndField(string updateOverride, string updateField)
|
||||
{
|
||||
this.updateOverride = updateOverride;
|
||||
this.updateField = updateField;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增
|
||||
/// </summary>
|
||||
/// <param name="time">插值时间</param>
|
||||
/// <param name="value">值</param>
|
||||
/// <param name="curveType">缓动曲线</param>
|
||||
[Convention.RScript.Variable.Attr.Method]
|
||||
public void Add(float time, T value, MathExtension.EaseCurveType curveType)
|
||||
{
|
||||
ManualAddEntry(time, value, curveType);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user