Пример #1
0
 public void OnSceneChanged()
 {
     puzzlePieces = GameObject.FindObjectOfType <LoadPuzzle>();
     if (isSolved && puzzlePieces.enabled == true)
     {
         puzzlePieces.enabled = false;
     }
 }
Пример #2
0
        public IActionResult Index()
        {
            // Show menu and button for create new
            var log    = new MessageLog();
            var loader = new LoadPuzzle(log);
            var model  = new PageModel();

            model.Menu = loader.ListPuzzleFiles("samples");

            return(View(model));
        }
Пример #3
0
        public IActionResult Sample(string id = "input")
        {
            id = id.FormatId();

            Puzzle puzzle;
            var    log    = new MessageLog();
            var    loader = new LoadPuzzle(log);

            puzzle = loader.LoadFromFile($"samples/{id}.txt");

            return(BuildSolutionModel(puzzle, log));
        }
Пример #4
0
        public IActionResult Index(string data = null)
        {
            if (string.IsNullOrWhiteSpace(data))
            {
                return(RedirectToAction("Index"));
            }

            var    log    = new MessageLog();
            var    loader = new LoadPuzzle(log);
            Puzzle puzzle = loader.LoadFromString(data);

            return(BuildSolutionModel(puzzle, log));
        }
    // Use this for initialization
    void Start()
    {
        gameManagerObject = GameObject.Find("GameManager") as GameObject;
        gameManager       = gameManagerObject.GetComponent <GameManager>();
        puzzleDatabase    = gameManagerObject.GetComponent <PuzzleDatabase>();

        CURSOR = Resources.Load("Prefabs/Cursor") as Object;
        cursor = Instantiate(CURSOR, Vector3.zero, Quaternion.identity) as GameObject;
        cursor.SetActive(false);

        START_ICON = Resources.Load("Prefabs/StartIcon") as Object;
        startIcon  = Instantiate(START_ICON, Vector3.zero, Quaternion.identity) as GameObject;

        END_ICON = Resources.Load("Prefabs/EndIcon") as Object;
        endIcon  = Instantiate(END_ICON, Vector3.zero, Quaternion.identity) as GameObject;

        SELECT_CIRCLE = Resources.Load("Prefabs/SelectCircle") as Object;
        selectCircle  = Instantiate(SELECT_CIRCLE, Vector3.zero, Quaternion.identity) as GameObject;
        selectCircle.SetActive(false);

        lineManager = gameObject.GetComponent <LineManager>();

        SIMPLE_NODE        = Resources.Load("Prefabs/SimpleNode");
        DIAGONAL_NODE      = Resources.Load("Prefabs/DiagonalNode");
        MOVING_SIMPLE_NODE = Resources.Load("Prefabs/MovingSimpleNode");

        TELEPORT_NODE = Resources.Load("Prefabs/TeleportNode");

        mousePosition  = Vector3.zero;
        cursorPosition = Vector3.zero;

        clearButton = GameObject.Find("ClearButton").GetComponent <Button>();
        clearButton.onClick.AddListener(ClearButtonClick);

        undoButton = GameObject.Find("UndoButton").GetComponent <Button>();
        undoButton.onClick.AddListener(UndoButtonClick);

        // Load puzzle
        loadPuzzle = GameObject.Find("LoadPuzzle").GetComponent <LoadPuzzle>();

        string puzzleLocation = puzzleDatabase.GetXml(gameManager.CurrentPuzzle);

        SetNodes(puzzleLocation);
    }
Пример #6
0
    // Use this for initialization

    void Start()
    {
        isSolved     = false;
        puzzlePieces = GameObject.FindObjectOfType <LoadPuzzle>();
        gp           = GameObject.FindObjectsOfType <GetPiece>();
    }