Exemplo n.º 1
0
    public void CheckForWin()
    {
        var endPoints = OctagonsList.Where(x => x.GetComponent <OctagonControllerScript>().octagonType == Enumerations.OctagonType.Endpoint).ToList();

        var nonEmptyOctagons = OctagonsList.Where(x => x.GetComponent <OctagonControllerScript>().octagonType != Enumerations.OctagonType.Empty).ToList();
        var pathTraverser    = new PathTraverser(endPoints[0], endPoints[1], nonEmptyOctagons);

        var levelWon = pathTraverser.CanTraverse();

        if (levelWon)
        {
            LevelWon(pathTraverser.GetCorrectPath());
        }
    }
Exemplo n.º 2
0
    public bool CheckForWin()
    {
        var endPoints = OctagonsList.Where(x => x.GetComponent <OctagonControllerScript>().octagonType == Enumerations.OctagonType.Endpoint).ToList();

        var nonEmptyOctagons = OctagonsList.Where(x => x.GetComponent <OctagonControllerScript>().octagonType != Enumerations.OctagonType.Empty).ToList();
        var pathTraverser    = new PathTraverser(endPoints[0], endPoints[1], nonEmptyOctagons);

        var levelWon = pathTraverser.CanTraverse();

        if (levelWon)
        {
            LevelWon(pathTraverser.GetCorrectPath());
            //winDialog.GetComponent<Animator>().SetBool("Show", true);

            if (currentPuzzleIterator == PuzzleList.Count - 1)
            {
                var x = winDialog.transform.Find("CanvasGroup").Find("NextButton").gameObject;
                x.transform.Find("Text").GetComponent <Text>().text = "Category Complete";
            }

            return(true);
        }
        else if (false) // TODO: GET THIS SHIT TO WORK WILL
        {
            // Delete old pathing lines
            foreach (var octagon in OctagonsList)
            {
                foreach (var lr in octagon.GetComponents <LineRenderer>())
                {
                    Destroy(lr);
                }
            }

            // Trace lines from the endpoint the path traverser already used
            TraceCurrentPaths(pathTraverser.GetConnectedPathways());

            // Trace lines from the other endpoint
            pathTraverser = new PathTraverser(endPoints[1], endPoints[0], nonEmptyOctagons);
            pathTraverser.CanTraverse();
            TraceCurrentPaths(pathTraverser.GetConnectedPathways());
        }

        return(false);
    }