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