コード例 #1
0
ファイル: MoveSystem.cs プロジェクト: xingchen1106/match3ecs
            public void Execute()
            {
                for (var x = 0; x < Helper.Width; ++x)
                {
                    var y = 0;
                    while (y < Helper.Height - 1)
                    {
                        var currIndex  = Helper.GetI(x, y);
                        var currEntity = CachedEntities[currIndex];
                        if (currEntity != Entity.Null)
                        {
                            y += 1;
                            continue;
                        }

                        var topY = y + 1;
                        while (topY < Helper.Height)
                        {
                            var topIndex  = Helper.GetI(x, topY);
                            var topEntity = CachedEntities[topIndex];

                            if (topEntity == Entity.Null)
                            {
                                topY += 1;
                                continue;
                            }

                            Position[topEntity] = new CellPositionComponent {
                                x = x, y = y
                            };
                            CachedEntities[topIndex]  = Entity.Null;
                            CachedEntities[currIndex] = topEntity;
                            break;
                        }
                        y += 1;
                    }
                }
            }
コード例 #2
0
            public void Execute()
            {
                var count = ClickedComponents.Length;

                for (var i = 0; i < count; ++i)
                {
                    var destroyPos    = ClickedComponents[i];
                    var clickedEntity = CachedEntities[Helper.GetI(destroyPos.x, destroyPos.y)];
                    if (clickedEntity == Entity.Null)
                    {
                        continue;
                    }

                    var groupSize = 0;

                    if (groupSize < MinGroupSize)
                    {
                        continue;
                    }
                }
            }
コード例 #3
0
ファイル: CacheJob.cs プロジェクト: xingchen1106/match3ecs
        public void Execute(int index)
        {
            var position = Positions[index];

            CachedEntities[Helper.GetI(position.x, position.y)] = Entities[index];
        }