Example #1
0
        private void OnPlatformFound(DetectedPlane plane, PlatformRequirement requirement)
        {
            var newPlatform = new DetectedPlatform(plane);

            requirement.Platform = newPlatform;
            LevelPlatforms.Add(newPlatform);
        }
Example #2
0
    private void LocateBoard(PlatformRequirement requirement)
    {
        // With the info taken from GetRowsRanges() we iterate
        //  each row until we find where we can locate the board

        int consecutiveValidRows = 0;
        int rowNum = 0, start = 0, end = columnsCount;
        List <Tuple <int, int> > RowsRanges = GetRowsRanges();

        while (consecutiveValidRows < requirement.MinimumRows && rowNum < rowsCount)
        {
            start = Math.Max(start, RowsRanges[rowNum].Item1);
            end   = Math.Min(end, RowsRanges[rowNum].Item2);

            if (end - start + 1 >= requirement.MinimumColumns)
            {
                consecutiveValidRows++;
            }
            else
            {
                consecutiveValidRows = 0;
            }

            rowNum++;
        }

        bool locationFound = consecutiveValidRows >= requirement.MinimumRows;

        if (locationFound)
        {
            int originRow = rowNum - consecutiveValidRows;
            int originCol = start;
            boardOrigin = new Coordinate(originRow, originCol);
        }
        else
        {
            Utils.ShowAndroidToastMessage("No se pudo insertar el tablero");
            throw new Exception("Board locations failed");
        }
    }
Example #3
0
 public void Build(PlatformRequirement requirement)
 {
     GenerateCoordinates(requirement.Platform);
     LocateBoard(requirement);
 }