Browse Source

it's possible to add a list of TO engines in the sequencer without condition

tags/Rel2b2
sebas77 6 years ago
parent
commit
292e5e51d3
1 changed files with 12 additions and 7 deletions
  1. +12
    -7
      Svelto.ECS/Sequencer.cs

+ 12
- 7
Svelto.ECS/Sequencer.cs View File

@@ -10,18 +10,22 @@ namespace Svelto.ECS
{
public void Add(IStep engine)
{
Add(Condition.always, new [] {engine});
Add(Condition.Always, new [] {engine});
}
public void Add(IStep[] engines)
{
Add(Condition.Always, engines);
}
}
public interface IStep
{ }
{}

public interface IStep<T>:IStep
{
void Step(ref T token, int condition);
}
public interface ISequencer
{
void Next<T>(IEngine engine, ref T param);
@@ -38,23 +42,24 @@ namespace Svelto.ECS

public void Next<T>(IEngine engine, ref T param)
{
Next(engine, ref param, Condition.always);
Next<T>(engine, ref param, Condition.Always);
}

public void Next<T>(IEngine engine, ref T param, int condition)
{
var steps = _steps[engine][condition];
int branch = condition;
var steps = _steps[engine][branch];

if (steps != null)
for (int i = 0; i < steps.Length; i++)
((IStep<T>)steps[i]).Step(ref param, condition);
}

Steps _steps;
Steps _steps;
}

public static class Condition
{
public const int always = 0;
public const int Always = 0;
}
}

Loading…
Cancel
Save