Ejemplo n.º 1
0
    private void NewMap()
    {
        _cubeCoordinates.Construct(10);

        // Remove 25% of Coordinates except 0,0,0
        foreach (Vector3 cube in _cubeCoordinates.GetCubesFromContainer("all"))
        {
            if (cube == Vector3.zero)
            {
                continue;
            }

            if (Random.Range(0.0f, 100.0f) < 25.0f)
            {
                _cubeCoordinates.RemoveCube(cube);
            }
        }

        // Remove Coordinates not reachable from 0,0,0
        _cubeCoordinates.RemoveCubes(
            _cubeCoordinates.BooleanDifferenceCubes(
                _cubeCoordinates.GetCubesFromContainer("all"),
                _cubeCoordinates.GetReachableCubes(Vector3.zero, 10)
                )
            );

        // Display Coordinates
        _cubeCoordinates.ShowCoordinatesInContainer("all");

        // Construct Examples
        ConstructExamples();
    }
Ejemplo n.º 2
0
        private void ConstructExamples()
        {
            List <Vector3> allCubes = _cubeCoordinates.GetCubesFromContainer("all");

            // Line between the first and last cube coordinate
            _cubeCoordinates.AddCubesToContainer(_cubeCoordinates.GetLineBetweenTwoCubes(allCubes[0], allCubes[allCubes.Count - 1]), "line");

            // Reachable, 3 coordinates away from 0.0.0
            _cubeCoordinates.AddCubesToContainer(_cubeCoordinates.GetReachableCubes(Vector3.zero, 3), "reachable");

            // Spiral, 3 coordinates away from 0.0.0
            _cubeCoordinates.AddCubesToContainer(_cubeCoordinates.GetSpiralCubes(Vector3.zero, 3), "spiral");

            // Path between the first and last cube coordinate
            _cubeCoordinates.AddCubesToContainer(_cubeCoordinates.GetPathBetweenTwoCubes(allCubes[0], allCubes[allCubes.Count - 1]), "path");
        }