Exemple #1
0
        private bool CheckAcceptableBlockState(Vector3Int position, Quaternion rotation, BlockShapeData shape)
        {
            if (!_levelPhysics.CheckShapeInsideLevelBounds(position, rotation, shape))
            {
                return(false);
            }

            if (_levelPhysics.CheckOverlappingLevelBlocks(position, rotation, shape))
            {
                return(false);
            }

            return(true);
        }
        private int ShiftUntilBorderOrBlockCollision(IBlockModel block, Vector3Int direction)
        {
            var pos    = block.Position;
            var offset = 1;

            for (; ; offset++)
            {
                var shift = direction * offset;
                if (_levelPhysics.CheckOverlappingLevelBlocks(pos + shift, block.Rotation, block.Shape))
                {
                    break;
                }
                if (!_levelPhysics.CheckShapeInsideLevelBounds(pos + shift, block.Rotation, block.Shape))
                {
                    break;
                }
            }
            return(offset - 1);
        }