예제 #1
0
    public void setup(EOTP_PuzzleCreator puzzle, PuzzleTutorialHints hintsWrapper)
    {
        int displayHints = PlayerPrefs.GetInt(OptionController.genericsOK[6]);

        if (displayHints == 0) //do not display hints
        {
            hint.SetActive(false);
            return;
        }

        myPuzzle = puzzle;
        tutStep  = -1;

        myHintWrapper = hintsWrapper;
        myHints       = hintsWrapper.hints;

        if (myHints.Length > 0)
        {
            hint.SetActive(true);
            nextHint();
        }
        else
        {
            hint.SetActive(false);
        }
    }
예제 #2
0
    public void setupPuzzle(EOTP_PuzzleCreator puzzle)
    {
        print("EOTP_PuzzleController:SetupPuzzle():!");
        isPuzzle = true;

        //spawn tiles
        int inputIndex = 0, outputIndex = 0;

        for (int i = 0; i < puzzle.IO.Length; i++)//For each unit in length
        {
            GameObject prefab = GC.spawnSingle(puzzle.IO[i].tileId, puzzle.IO[i].getSpotIndex(puzzle.length), puzzle.IO[i].dir);
            prefab.GetComponent <TileController>().locked = true;

            print("EOTP_PuzzleController:SetupPuzzle():spawning i: " + i + "/" + prefab.name);
            if (puzzle.IO[i].input)
            {
                prefab.GetComponent <TileController>().myLabel = TileController.label.IN;
                prefab.GetComponent <PInputController>().setSprite(inputIndex);
                inputIndex++;
                inputs.Add(puzzle.IO[i]);
                inputObjs.Add(prefab);

                //For each input, add a list
                realInput.Add(new List <int>());
                actualInput.Add(0);
            }
            else
            {
                prefab.GetComponent <TileController>().myLabel = TileController.label.OUT;
                prefab.GetComponent <POutputController>().setSprite(outputIndex);
                outputIndex++;
                outputs.Add(puzzle.IO[i]);
                outputObjs.Add(prefab);
            }

            GameObject lockP = Instantiate(lockPrefab, prefab.transform);
            lockP.transform.position += new Vector3(-0.35f, 0.35f, 0);
        }

        myPuzzle = puzzle;
        PO.setup(puzzle);
        PTT.setup(puzzle);

        //Info
        if (myPuzzle.info != null)
        {
            infoButton.SetActive(!myPuzzle.info.Trim().Equals(""));
            infoText.text = myPuzzle.info;
        }
        else
        {
            infoButton.SetActive(false);
        }
        puzzleInfo.SetActive(false);

        //Step
        stepText.gameObject.SetActive(false);
        stopStepButton.SetActive(false);

        //Tutorial
        List <PuzzleTutorialHints> temp = ResourceLoader.loadJsonFolder <PuzzleTutorialHints>("/Tutorial/");
        PuzzleTutorialHints        myHintWrapper = null;

        foreach (PuzzleTutorialHints hints in temp)
        {
            if (hints.puzzleId == myPuzzle.id)
            {
                myHintWrapper = hints;
            }
        }
        if (myHintWrapper != null) //Spawn tut on all that have tut from json
        {
            PT.setup(puzzle, myHintWrapper);
        }
        else
        {
            PT.closeAll();
        }

        //middleWaitTime
        print("Puzzle Middle Time: " + puzzle.middleWaitTime);
        if (puzzle.middleWaitTime > 0)
        {
            EOTP_MIDDLE_WAIT_TIME_MS = puzzle.middleWaitTime;
        }
        else
        {
            EOTP_MIDDLE_WAIT_TIME_MS = DEFAULT_MIDDLE_WAIT_TIME;
        }

        //show objective at start
        PO.openObjective();
    }