Exemplo n.º 1
0
    public void RenderFrame()
    {
        Vector2Int fieldSize = gameMode.GetFieldSize();

        int[,] field = gameMode.GetField();

        Vector2Int offset = new Vector2Int(Screen.width / 2 - fieldSize.x * cellSize / 2, Screen.height / 2 - fieldSize.y * cellSize / 2);

        Rect backgroundRect = new Rect(offset.x, offset.y, fieldSize.x * cellSize, fieldSize.y * cellSize);

        GUI.DrawTexture(backgroundRect, backgroundTexture);

        DrawGrid(offset, field);

        Rect labelRect = backgroundRect;

        labelRect.center += new Vector2(labelRect.width + 10, 0);

        GUIStyle labelStyle = new GUIStyle();

        labelStyle.fontSize         = 20;
        labelStyle.normal.textColor = Color.white;

        GUI.Label(labelRect,
                  "Controls:\n" +
                  "1,2 - Switch mode\n" +
                  "P - pause, R - restart\n" +
                  "Left, Right arrows - move horizontally\n" +
                  "Up arrow or X - rotate clockwise\n" +
                  "Left control or Z - rotate counter-clockwise\n" +
                  "Down arrow - force land\n",
                  labelStyle);
    }