/// <summary>
        /// Generates a foreground layer of objects at the start of each scenario iteration
        /// </summary>
        protected override void OnIterationStart()
        {
            var seed             = SamplerState.NextRandomState();
            var placementSamples = PoissonDiskSampling.GenerateSamples(
                placementArea.x, placementArea.y, separationDistance, seed);
            var offset = new Vector3(placementArea.x, placementArea.y, 0f) * -0.5f;

            foreach (var sample in placementSamples)
            {
                var instance = m_GameObjectOneWayCache.GetOrInstantiate(prefabs.Sample());
                instance.transform.position = new Vector3(sample.x, sample.y, depth) + offset;
            }
            placementSamples.Dispose();
        }
        public IEnumerator GeneratedRandomSeedsChangeWithScenarioIteration()
        {
            yield return(CreateNewScenario(3, 1));

            var seeds = new uint[3];

            for (var i = 0; i < 3; i++)
            {
                seeds[i] = SamplerState.NextRandomState();
            }

            yield return(null);

            for (var i = 0; i < 3; i++)
            {
                Assert.AreNotEqual(seeds[i], SamplerState.NextRandomState());
            }
        }
        void PlaceObjects()
        {
            m_SpawnedCount = 0;

            var seed             = SamplerState.NextRandomState();
            var placementSamples = PoissonDiskSampling.GenerateSamples(
                placementArea.x, placementArea.y, separationDistance.Sample(), seed);
            var offset = new Vector3(placementArea.x, placementArea.y, 0) * -0.5f;

            foreach (var sample in placementSamples)
            {
                var instance = m_GameObjectOneWayCache.GetOrInstantiate(prefabs.Sample());
                instance.transform.position = new Vector3(sample.x, sample.y, depth) + offset;
                m_SpawnedObjects.Add(instance);

                if (++m_SpawnedCount == maxObjectCount)
                {
                    break;
                }
            }
            placementSamples.Dispose();
        }