mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 01:54:35 +08:00
update
This commit is contained in:
parent
ba93aa4871
commit
7b31c7d0ba
@ -147,6 +147,13 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UnityEvents
|
||||
private void OnDestroy()
|
||||
{
|
||||
Disconnect();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Editor
|
||||
#if UNITY_EDITOR
|
||||
[ContextMenu("Autoset")]
|
||||
|
@ -7,7 +7,7 @@ using UnityEditor;
|
||||
namespace DCFApixels.DragonECS
|
||||
{
|
||||
[MetaColor(MetaColor.Cyan)]
|
||||
public readonly struct UnityGameObjectConnect : IEcsComponent
|
||||
public readonly struct UnityGameObjectConnect : IEcsComponent, IEcsComponentLifecycle<UnityGameObjectConnect>
|
||||
{
|
||||
public readonly EcsEntityConnect connect;
|
||||
public readonly Transform transform;
|
||||
@ -16,21 +16,29 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return connect.name; }
|
||||
}
|
||||
public bool IsUnidirectional
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return connect == null; }
|
||||
}
|
||||
public bool IsConnected
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return transform != null; }
|
||||
get { return connect != null; }
|
||||
}
|
||||
internal UnityGameObjectConnect(EcsEntityConnect connect)
|
||||
{
|
||||
this.connect = connect;
|
||||
transform = connect.transform;
|
||||
}
|
||||
|
||||
void IEcsComponentLifecycle<UnityGameObjectConnect>.Enable(ref UnityGameObjectConnect component)
|
||||
{
|
||||
component = default;
|
||||
}
|
||||
void IEcsComponentLifecycle<UnityGameObjectConnect>.Disable(ref UnityGameObjectConnect component)
|
||||
{
|
||||
if (component.connect != null)
|
||||
{
|
||||
component.connect.Disconnect();
|
||||
}
|
||||
component = default;
|
||||
}
|
||||
}
|
||||
|
||||
public enum GameObjectIcon : byte
|
||||
|
Loading…
Reference in New Issue
Block a user