mirror of
https://github.com/DCFApixels/DragonECS-Graphs.git
synced 2025-09-18 20:04:35 +08:00
update
This commit is contained in:
parent
285649c47c
commit
2165342fb0
@ -77,7 +77,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region New
|
||||
#region New/Convert
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public int NewRelation(int startEntityID, int endEntityID)
|
||||
{
|
||||
@ -96,19 +96,54 @@ namespace DCFApixels.DragonECS
|
||||
private int NewRelationInternal(int startEntityID, int endEntityID)
|
||||
{
|
||||
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);
|
||||
_relEntityInfos[relEntityID] = new RelationInfo(startEntityID, endEntityID);
|
||||
_count++;
|
||||
return relEntityID;
|
||||
}
|
||||
#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)]
|
||||
public bool HasRelation(int startEntityID, int 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
|
||||
|
||||
#region Get
|
||||
@ -133,7 +168,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void ClearRelation_Internal(int relEntityID)
|
||||
internal void ClearRelation_Internal(int relEntityID)
|
||||
{
|
||||
ref RelationInfo info = ref _relEntityInfos[relEntityID];
|
||||
if (_matrix.TryDel(info.start, info.end))
|
||||
@ -145,15 +180,7 @@ namespace DCFApixels.DragonECS
|
||||
#endregion
|
||||
|
||||
#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)]
|
||||
public StartEnd GetRelationStartEnd(int relEntityID)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8bbdbeffc4dbc37478284bfc4d2c8d59
|
||||
guid: 3beb57467f719d140a946d35ecc5ea89
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1ebb7cb8c3ca3e74dbcec878a032442e
|
||||
guid: 977f5bbe4e8bc404bba34ac573f110f2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -50,6 +50,11 @@ namespace DCFApixels.DragonECS
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return _lastWorldVersion; }
|
||||
}
|
||||
public EcsGraph Graph
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get { return _graph; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OnInitialize/OnDestroy
|
||||
@ -210,7 +215,7 @@ namespace DCFApixels.DragonECS
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
public enum EcsSubGraphMode
|
||||
{
|
||||
NONE = 0,
|
||||
@ -293,10 +298,14 @@ namespace DCFApixels.DragonECS
|
||||
{
|
||||
private readonly EcsJoinToSubGraphExecutor _executer;
|
||||
private readonly EcsSpan _startEntities;
|
||||
public EcsSpan StartEntitiesSpan
|
||||
public EcsSpan FromEntitiesSpan
|
||||
{
|
||||
get { return _startEntities; }
|
||||
}
|
||||
public EcsGraph Graph
|
||||
{
|
||||
get { return _executer.Graph; }
|
||||
}
|
||||
internal EcsSubGraph(EcsJoinToSubGraphExecutor executer, EcsSpan startEntites)
|
||||
{
|
||||
_executer = executer;
|
||||
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37a368fc468a4f845ba8f0426d44ac46
|
||||
guid: e335dc14566ec42419fc26638072e636
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -332,7 +332,7 @@ namespace DCFApixels.DragonECS.Graphs.Internal
|
||||
this.yHash = yHash;
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Key FromXY(int x, int y)
|
||||
public static Key FromXY(int x, int y)
|
||||
{
|
||||
unchecked
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user