mirror of
https://github.com/DCFApixels/DragonECS-Graphs.git
synced 2025-09-19 04:24:35 +08:00
update
This commit is contained in:
parent
285649c47c
commit
2165342fb0
@ -77,7 +77,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region New
|
#region New/Convert
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public int NewRelation(int startEntityID, int endEntityID)
|
public int NewRelation(int startEntityID, int endEntityID)
|
||||||
{
|
{
|
||||||
@ -96,19 +96,54 @@ namespace DCFApixels.DragonECS
|
|||||||
private int NewRelationInternal(int startEntityID, int endEntityID)
|
private int NewRelationInternal(int startEntityID, int endEntityID)
|
||||||
{
|
{
|
||||||
int relEntityID = _graphWorld.NewEntity();
|
int relEntityID = _graphWorld.NewEntity();
|
||||||
|
ConvertToRelationInternal(relEntityID, startEntityID, endEntityID);
|
||||||
|
return relEntityID;
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ConvertToRelation(int entityID, int startEntityID, int endEntityID)
|
||||||
|
{
|
||||||
|
if (IsRelation(entityID))
|
||||||
|
{
|
||||||
|
Throw.UndefinedException();
|
||||||
|
}
|
||||||
|
ConvertToRelationInternal(entityID, startEntityID, endEntityID);
|
||||||
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public void ConvertToRelationInternal(int relEntityID, int startEntityID, int endEntityID)
|
||||||
|
{
|
||||||
_matrix.Add(startEntityID, endEntityID, relEntityID);
|
_matrix.Add(startEntityID, endEntityID, relEntityID);
|
||||||
_relEntityInfos[relEntityID] = new RelationInfo(startEntityID, endEntityID);
|
_relEntityInfos[relEntityID] = new RelationInfo(startEntityID, endEntityID);
|
||||||
_count++;
|
_count++;
|
||||||
return relEntityID;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Has
|
#region Inverse
|
||||||
|
public int GetInverseRelation(int relEntityID)
|
||||||
|
{
|
||||||
|
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length)
|
||||||
|
{
|
||||||
|
Throw.UndefinedException();
|
||||||
|
}
|
||||||
|
var x = _relEntityInfos[relEntityID];
|
||||||
|
return GetOrNewRelation(x.end, x.start);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Has/Is
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public bool HasRelation(int startEntityID, int endEntityID)
|
public bool HasRelation(int startEntityID, int endEntityID)
|
||||||
{
|
{
|
||||||
return _matrix.HasKey(startEntityID, endEntityID);
|
return _matrix.HasKey(startEntityID, endEntityID);
|
||||||
}
|
}
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public bool IsRelation(int relEntityID)
|
||||||
|
{
|
||||||
|
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !_relEntityInfos[relEntityID].IsNull;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Get
|
#region Get
|
||||||
@ -133,7 +168,7 @@ namespace DCFApixels.DragonECS
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void ClearRelation_Internal(int relEntityID)
|
internal void ClearRelation_Internal(int relEntityID)
|
||||||
{
|
{
|
||||||
ref RelationInfo info = ref _relEntityInfos[relEntityID];
|
ref RelationInfo info = ref _relEntityInfos[relEntityID];
|
||||||
if (_matrix.TryDel(info.start, info.end))
|
if (_matrix.TryDel(info.start, info.end))
|
||||||
@ -145,15 +180,7 @@ namespace DCFApixels.DragonECS
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ArcEntityInfo
|
#region ArcEntityInfo
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
public bool IsRelation(int relEntityID)
|
|
||||||
{
|
|
||||||
if (relEntityID <= 0 || relEntityID >= _relEntityInfos.Length)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return !_relEntityInfos[relEntityID].IsNull;
|
|
||||||
}
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public StartEnd GetRelationStartEnd(int relEntityID)
|
public StartEnd GetRelationStartEnd(int relEntityID)
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 8bbdbeffc4dbc37478284bfc4d2c8d59
|
guid: 3beb57467f719d140a946d35ecc5ea89
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 1ebb7cb8c3ca3e74dbcec878a032442e
|
guid: 977f5bbe4e8bc404bba34ac573f110f2
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
@ -50,6 +50,11 @@ namespace DCFApixels.DragonECS
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get { return _lastWorldVersion; }
|
get { return _lastWorldVersion; }
|
||||||
}
|
}
|
||||||
|
public EcsGraph Graph
|
||||||
|
{
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
get { return _graph; }
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region OnInitialize/OnDestroy
|
#region OnInitialize/OnDestroy
|
||||||
@ -293,10 +298,14 @@ namespace DCFApixels.DragonECS
|
|||||||
{
|
{
|
||||||
private readonly EcsJoinToSubGraphExecutor _executer;
|
private readonly EcsJoinToSubGraphExecutor _executer;
|
||||||
private readonly EcsSpan _startEntities;
|
private readonly EcsSpan _startEntities;
|
||||||
public EcsSpan StartEntitiesSpan
|
public EcsSpan FromEntitiesSpan
|
||||||
{
|
{
|
||||||
get { return _startEntities; }
|
get { return _startEntities; }
|
||||||
}
|
}
|
||||||
|
public EcsGraph Graph
|
||||||
|
{
|
||||||
|
get { return _executer.Graph; }
|
||||||
|
}
|
||||||
internal EcsSubGraph(EcsJoinToSubGraphExecutor executer, EcsSpan startEntites)
|
internal EcsSubGraph(EcsJoinToSubGraphExecutor executer, EcsSpan startEntites)
|
||||||
{
|
{
|
||||||
_executer = executer;
|
_executer = executer;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 37a368fc468a4f845ba8f0426d44ac46
|
guid: e335dc14566ec42419fc26638072e636
|
||||||
MonoImporter:
|
MonoImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
Loading…
Reference in New Issue
Block a user