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