Skip to content

Commit

Permalink
ECS - made field ChunkEntities.Start public
Browse files Browse the repository at this point in the history
  • Loading branch information
friflo committed Aug 8, 2024
1 parent 970d3cd commit eb06d20
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/ECS/Query/ChunkEntities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Friflo.Engine.ECS;
{
#region public properties
/// <summary> Return the entity <see cref="Entity.Id"/>'s for the components in a <see cref="Chunk{T}"/>. </summary>
public ReadOnlySpan<int> Ids => new(Archetype.entityIds, start, Length);
public ReadOnlySpan<int> Ids => new(Archetype.entityIds, Start, Length);
public override string ToString() => GetString();
#endregion

Expand All @@ -37,7 +37,7 @@ namespace Friflo.Engine.ECS;
public readonly Archetype Archetype; // 8

// ReSharper disable once NotAccessedField.Local
internal readonly int start; // 4
public readonly int Start; // 4

/// <summary> The number of entities in <see cref="ChunkEntities"/>. </summary>
public readonly int Length; // 4
Expand All @@ -59,15 +59,15 @@ internal ChunkEntities(Archetype archetype, int componentLen, int start) {
Archetype = archetype;
entityIds = archetype.entityIds;
Length = componentLen;
this.start = start;
Start = start;
}

internal ChunkEntities(in ChunkEntities entities, int start, int componentLen, int taskIndex) {
Archetype = entities.Archetype;
Execution = JobExecution.Parallel;
TaskIndex = (byte)taskIndex;
entityIds = entities.entityIds;
this.start = start;
Start = start;
Length = componentLen;
}

Expand All @@ -84,7 +84,7 @@ internal ChunkEntities(in ChunkEntities entities, int taskIndex) {
public int this[int index] {
get {
if (index < Length) {
return entityIds[start + index];
return entityIds[Start + index];
}
throw new IndexOutOfRangeException();
}
Expand All @@ -95,7 +95,7 @@ public int this[int index] {
/// </summary>
public Entity EntityAt(int index) {
if (index < Length) {
return new Entity(Archetype.entityStore, entityIds[start + index]);
return new Entity(Archetype.entityStore, entityIds[Start + index]);
}
throw new IndexOutOfRangeException();
}
Expand Down Expand Up @@ -147,7 +147,7 @@ public struct ChunkEntitiesEnumerator : IEnumerator<Entity>
internal ChunkEntitiesEnumerator(in ChunkEntities chunkEntities) {
entityIds = chunkEntities.entityIds;
store = chunkEntities.Archetype.entityStore;
index = chunkEntities.start - 1;
index = chunkEntities.Start - 1;
last = chunkEntities.Length + index;
}

Expand Down

0 comments on commit eb06d20

Please sign in to comment.