Exemplo n.º 1
0
        //Handles the collision and if no obstruction, we move the block
        //Also handles the touchdown scenario (played block is finished)
        public async void Move(Block.Direction dir)
        {
            //Creates the virtual block to check for potential collisions
            Block MovedBlock = CurrentBlock.CreateMoved(dir);

            //Checks for obstructed place
            if (MovedBlock.CheckCollision(Map))
            {
                //Down collision is a special case: touchdown
                if (dir == Block.Direction.Down)
                {
                    //Handles touchdown event
                    Touchdown();
                }
            }
            else
            {
                //No obstruction -> can move the block
                CurrentBlock.Move(dir);
            }
        }