Esempio n. 1
0
        protected override void OnUpdate()
        {
            var gameState = GetSingleton <GameStateData>();

            if (gameState.State != GameState.Spawn)
            {
                return;
            }

            var cmdBuffer         = new EntityCommandBuffer(Allocator.TempJob);
            var cellManagerEntity = GetSingletonEntity <CellManager>();
            var cellManager       = GetSingleton <CellManager>();
            var cellSprites       = EntityManager.GetBuffer <CellSprite>(cellManagerEntity);
            var cellPrefabSR      = EntityManager.GetComponentData <SpriteRenderer>(cellManager.CellPrefab);

            // look at every column and spawn if it's less than minimum
            for (var x = 0; x < cellManager.MaxCol; x++)
            {
                var jobResult = new NativeList <CellInfo>(Allocator.Temp);
                Entities.ForEach((
                                     in Entity entity,
                                     in Cell cell) =>
                {
                    CellUtil.AddCellAtColumn(entity, cell, x, ref jobResult);
                }).Run();