Пример #1
0
    public void GoToMenu()
    {
        try {
            fileManager.EndLog();
        } catch {
            Debug.Log("Tried to close a non-existant filestream");
        }
        titleManager.enabled          = true;
        boardBehaviour.winner         = 0;
        endGameInfoController.enabled = false;
        inMenu       = true;
        menuState    = MenuState.main;
        menuOptions1 = MenuOptions1.start;
        menuOptions2 = MenuOptions2.pvp;
        camera.transform.position           = new Vector3(50F, 50F, 20);
        camera.transform.rotation           = Quaternion.Euler(0, 0, 0);
        cameraController.rotationMultiplier = 0;
        gameManager.EndGame();
        boardBehaviour.ResetBoard();
        updateNeeded = true;

        button1.selected = true;
        button2.selected = false;
        button3.selected = false;
        button4.selected = false;
        button5.selected = false;
    }
Пример #2
0
    /// <summary>
    /// Populates the MapState array with the board's state at each turn
    /// </summary>
    /// <param name="numberOfTurns">Number of turns.</param>
    void PopulateTurns(int numberOfTurns)
    {
        string temp;

        boardBehaviour.ResetBoard();

        mapState [0].map = new int[8, 8];

        mapState [0].map [3, 3] = 1;
        mapState [0].map [3, 4] = 2;
        mapState [0].map [4, 3] = 2;
        mapState [0].map [4, 4] = 1;

        for (int turn = 1; turn < numberOfTurns + 1; turn++)
        {
            temp = streamReader.ReadLine();

            string[] contents = temp.Split(',');

            boardBehaviour.SetTileState(int.Parse(contents [1]), int.Parse(contents [2]), int.Parse(contents [0]), false);

            mapState [turn].map = new int[8, 8];

            Array.Copy(boardBehaviour.board, mapState [turn].map, boardBehaviour.board.Length);
        }

        Array.Copy(mapState [0].map, boardBehaviour.board, mapState [0].map.Length);
    }