blob: 84976c78716938a6b5f0880dc9819f2e3cef2fed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#nullable enable
using System.Collections.Generic;
namespace MorgSimulator.Framework
{
public class EntityIterator<T> : IEntityIterator<T> where T : Entity
{
private readonly List<T> _entities;
private int _currentIndex = 0;
public EntityIterator(List<T> entities)
{
_entities = entities;
}
public bool HasNext()
{
return _currentIndex < _entities.Count;
}
public T? Next()
{
if (!HasNext())
return null;
return _entities[_currentIndex++];
}
public void Reset()
{
_currentIndex = 0;
}
}
}
#nullable disable
|