|
|
|
|
|
|
public TextAsset configuration; |
|
|
|
|
|
|
|
private bool m_ShouldRestartIteration; |
|
|
|
private bool m_ShouldDelayIteration; |
|
|
|
|
|
|
|
private const int k_MaxIterationStartCount = 100; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
do |
|
|
|
{ |
|
|
|
m_ShouldRestartIteration = false; |
|
|
|
m_ShouldDelayIteration = false; |
|
|
|
iterationStartCount++; |
|
|
|
foreach (var randomizer in activeRandomizers) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
if (m_ShouldDelayIteration) |
|
|
|
{ |
|
|
|
Debug.Log($"Iteration was delayed by {randomizer.GetType().Name}"); |
|
|
|
break; |
|
|
|
} |
|
|
|
if (m_ShouldDelayIteration) |
|
|
|
break; |
|
|
|
} while (m_ShouldRestartIteration && iterationStartCount < k_MaxIterationStartCount); |
|
|
|
|
|
|
|
if (m_ShouldRestartIteration) |
|
|
|
|
|
|
randomizer.Update(); |
|
|
|
|
|
|
|
// Iterate scenario frame count
|
|
|
|
currentIterationFrame++; |
|
|
|
if (!m_ShouldDelayIteration) |
|
|
|
currentIterationFrame++; |
|
|
|
|
|
|
|
framesSinceInitialization++; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
public void RestartIteration() |
|
|
|
{ |
|
|
|
m_ShouldRestartIteration = true; |
|
|
|
} |
|
|
|
|
|
|
|
public void DelayIteration() |
|
|
|
{ |
|
|
|
m_ShouldDelayIteration = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |