Пример #1
0
    void Init_Cells()
    {
        cells = new Cell[8, 8];

        if (SceneManager.GetActiveScene().name == "Game")
        {
            Debug.Log("Game");
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    GetCells()[i < 2 ? i : i + 4, j] = i < 2 ? Cell.WhiteFigure : Cell.BlackFigure;
                }
            }

            GetCells()[0, 4] |= Cell.King;
            GetCells()[7, 4] |= Cell.King;
        }
        // FOR_TEST Scene.
        else
        {
            Debug.Log("FOR_TEST");
            CellUtils.UpdateCells();
        }
    }
    void OnGUI()
    {
        if (EditorApplication.isPlaying && Board.Instance.GetCells() != null)
        {
            if (GUILayout.Button("Update the Cells") || update)
            {
                CellUtils.UpdateCells();
                update = false;
            }

            DisplayCells();

            // Display amount of chessmen after cells.
            GUILayout.Label("WhiteChessmen: " + Board.Instance.WhiteChessmen.Count);
            GUILayout.Label("BlackChessmen: " + Board.Instance.BlackChessmen.Count);
        }
        else
        {
            update = true;
        }
    }