Пример #1
0
    public List<GameObject> ParseRowFromBlock(GameObject block)
    {
        List<GameObject> blocksOnRow = new List<GameObject>();

        if (blockStore.GetAllBlocks() != null)
        {
            List<GameObject> blocks = blockStore.GetAllBlocksByRow(block.transform.position.y).OrderBy(x => x.transform.position.x).ToList();

            if(blocks.Count() == 1)
            {
                return new List<GameObject>();
            }

            for(int i = 0; i < blocks.Count(); i++)
            {

                blocksOnRow.Add(blocks.ElementAt(i));

                if (blocks.ElementAt(i) == blocks.Last())
                {
                    break;
                }

                if (!(blocks.ElementAt(i).transform.position.x + 1 == blocks.ElementAt(i + 1).transform.position.x))
                {
                    blocksOnRow.Add(null);
                }
            }
        }
        return blocksOnRow;
    }