This commit is contained in:
Mikhail 2023-06-22 09:10:51 +08:00
parent 8dce296a25
commit 7792ce5990

View File

@ -120,12 +120,12 @@ namespace DragonECS.DragonECS
#region Has #region Has
public bool HasRelation(int entityID, int otherEntityID) => _source._relationsMatrix.Contains(entityID, otherEntityID); public bool HasRelation(int entityID, int otherEntityID) => _source._relationsMatrix.Contains(entityID, otherEntityID);
public bool HasRelationWith(EcsSubject subject, int entityID, int otherEntityID) //public bool HasRelationWith(EcsSubject subject, int entityID, int otherEntityID)
{ //{
if (subject.World != _relationWorld) // if (subject.World != _relationWorld)
throw new ArgumentException(); // throw new ArgumentException();
return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out int entity) && subject.IsMatches(entity); // return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out int entity) && subject.IsMatches(entity);
} //}
#endregion #endregion
#region GetRelation #region GetRelation
@ -139,27 +139,32 @@ namespace DragonECS.DragonECS
{ {
return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out entity); return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out entity);
} }
public bool TryGetRelation(EcsSubject subject, int entityID, int otherEntityID, out int entity) //public bool TryGetRelation(EcsSubject subject, int entityID, int otherEntityID, out int entity)
{ //{
return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out entity) && subject.IsMatches(entity); // return _source._relationsMatrix.TryGetValue(entityID, otherEntityID, out entity) && subject.IsMatches(entity);
} //}
#endregion #endregion
#region GetRelations #region GetRelations
//ReadOnlySpan<int> временная заглушка, потому тут будет спан из линкедлиста public IdsLinkedList.Span GetRelations(int entityID)
public ReadOnlySpan<int> GetRelations(int entityID)
{ {
throw new NotImplementedException(); return _basket.GetSpanFor(entityID);
} }
//ReadOnlySpan<int> временная заглушка, потому тут будет спан из линкедлиста //ReadOnlySpan<int> временная заглушка, потому тут будет спан из линкедлиста
public ReadOnlySpan<int> GetRelationsWith(EcsSubject subject, int entityID) //public ReadOnlySpan<int> GetRelationsWith(EcsSubject subject, int entityID)
{ //{
if (subject.World != _relationWorld) // if (subject.World != _relationWorld)
throw new ArgumentException(); // throw new ArgumentException();
throw new NotImplementedException(); // throw new NotImplementedException();
} //}
#endregion #endregion
} }
public struct RelationsSpan
{
private readonly IdsBasket _basket;
private readonly EcsSubject _subject;
}
#endregion #endregion
} }