SubWorld与LookAtAnchor Config更新
This commit is contained in:
@@ -46,6 +46,8 @@ namespace Demo.Game
|
||||
protected override IEnumerator DoSomethingDuringApplyScript()
|
||||
{
|
||||
yield return base.DoSomethingDuringApplyScript();
|
||||
if (string.IsNullOrEmpty(GetConfig<ConfigType.SubWorldConfig>().project))
|
||||
yield break;
|
||||
var ir = SceneManager.LoadSceneAsync(Editor.EditorController.SceneName, LoadSceneMode.Additive);
|
||||
ir.completed += x =>
|
||||
{
|
||||
|
||||
@@ -1,10 +1,30 @@
|
||||
using Convention;
|
||||
using Demo.Game.Attr;
|
||||
using Demo.Game.ConfigType;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Demo.Game
|
||||
{
|
||||
namespace ConfigType
|
||||
{
|
||||
public class LookAtAnchorConfig : UpdatementIntConfig
|
||||
{
|
||||
[Content] public bool IsEnableUpdateEveryTick = false;
|
||||
public override void Deserialize(BinaryReader reader)
|
||||
{
|
||||
IsEnableUpdateEveryTick = BinarySerializeUtility.ReadBool(reader);
|
||||
base.Deserialize(reader);
|
||||
}
|
||||
|
||||
public override void Serialize(BinaryWriter writer)
|
||||
{
|
||||
BinarySerializeUtility.WriteBool(writer, IsEnableUpdateEveryTick);
|
||||
base.Serialize(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Scriptable]
|
||||
public class LookAtAnchor : Updatement<int>
|
||||
{
|
||||
@@ -22,15 +42,19 @@ namespace Demo.Game
|
||||
return begin;
|
||||
}
|
||||
|
||||
[Content] public int LookAtObject;
|
||||
[Content] public bool IsEnableUpdateEveryTick = false;
|
||||
public int LookAtObjectCache;
|
||||
public bool IsEnableUpdateEveryTick
|
||||
{
|
||||
get => GetConfig<LookAtAnchorConfig>().IsEnableUpdateEveryTick;
|
||||
set => GetConfig<LookAtAnchorConfig>().IsEnableUpdateEveryTick = value;
|
||||
}
|
||||
|
||||
protected override void UpdateData(int data)
|
||||
{
|
||||
ScriptableObject target = GetRoot().FindWithIndex(data);
|
||||
if (data != LookAtObject)
|
||||
if (data != LookAtObjectCache)
|
||||
{
|
||||
LookAtObject = data;
|
||||
LookAtObjectCache = data;
|
||||
if (target != null)
|
||||
transform.LookAt(target.transform);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user