Пример #1
0
 /// <summary>
 /// Switch on, or shut off, all buttons.
 /// </summary>
 /// <param name="onOrOff">Whether the buttons should be on (gameobject active) or off (inactive).</param>
 public virtual void ToggleAllButtons(OnOrOff onOrOff)
 {
     TogglePhaseButton(onOrOff);
     ToggleUndoButton(onOrOff);
     ToggleExplainButton(onOrOff);
     ToggleTutorialButton(onOrOff);
 }
Пример #2
0
    /// <summary>
    /// Change the state of a space's highlight, on or off.
    /// </summary>
    /// <param name="x">The x coordinate of the space in the grid.</param>
    /// <param name="z">The z coordinate of the space in the grid.</param>
    /// <param name="onOrOff">Should hte highlight be turned on or switched off?</param>
    public void HighlightSpace(int x, int z, OnOrOff onOrOff)
    {
        Debug.Assert(CheckValidSpace(x, z), "Attempting to highlight invalid space: x == " + x + ", z == " + z);


        bool state = onOrOff == OnOrOff.On ? true : false;

        spaces[x, z].transform.Find(HIGHLIGHT_OBJ).gameObject.SetActive(state);
    }
Пример #3
0
 /// <summary>
 /// Highlight the entire board, or remove highlights from the entire board.
 /// </summary>
 /// <param name="onOrOff">Should the highlight be turned on or switched off?</param>
 public void HighlightAll(OnOrOff onOrOff)
 {
     for (int x = 0; x < BOARD_WIDTH; x++)
     {
         for (int z = 0; z < BOARD_HEIGHT; z++)
         {
             HighlightSpace(x, z, onOrOff, false);
         }
     }
 }
Пример #4
0
 /// <summary>
 /// Highlight all spaces in a row.
 /// </summary>
 /// <param name="z">The z coordinate in the grid of the row to be highlighted, zero-indexed.</param>
 /// <param name="onOrOff">Should the highlight be turned on or switched off?</param>
 public void HighlightRow(int z, OnOrOff onOrOff)
 {
     if (CheckValidRow(z))
     {
         for (int x = 0; x < BOARD_WIDTH; x++)
         {
             HighlightSpace(x, z, onOrOff);
         }
     }
 }
Пример #5
0
 /// <summary>
 /// Highlight all spaces in a column.
 /// </summary>
 /// <param name="x">The x coordinate of the column to be highlighted, zero-indexed.</param>
 /// <param name="onOrOff">Should the highlight be turned on or switched off?</param>
 public void HighlightColumn(int x, OnOrOff onOrOff)
 {
     if (CheckValidColumn(x))
     {
         for (int z = 0; z < BOARD_HEIGHT; z++)
         {
             HighlightSpace(x, z, onOrOff);
         }
     }
 }
Пример #6
0
 /// <summary>
 /// Highlight next to a given space.
 /// </summary>
 /// <param name="x">The x coordinate in the grid of the central space.</param>
 /// <param name="z">The z coordinate in the grid of the central space.</param>
 /// <param name="onOrOff">Should the highlight be turned on or switched off?</param>
 public void HighlightNextToSpace(int x, int z, OnOrOff onOrOff)
 {
     if (CheckValidSpace(x - 1, z))
     {
         HighlightSpace(x - 1, z, onOrOff);
     }
     if (CheckValidSpace(x + 1, z))
     {
         HighlightSpace(x - 1, z, onOrOff);
     }
 }
Пример #7
0
 /// <summary>
 /// Switch the cursor's graphic on or off.
 /// </summary>
 /// <param name="onOrOff">Whether the graphic should appear or not.</param>
 public void ToggleCursor(OnOrOff onOrOff)
 {
     if (onOrOff == OnOrOff.On)
     {
         Cursor.visible = true;
     }
     else
     {
         Cursor.visible = false;
     }
 }
Пример #8
0
 /// <summary>
 /// Switch the button that triggers tutorials.
 /// </summary>
 /// <param name="onOrOff">Whether the button should be displayed (gameobject active) or off (inactive).</param>
 public virtual void ToggleTutorialButton(OnOrOff onOrOff)
 {
     if (onOrOff == OnOrOff.On)
     {
         tutorialButton.SetActive(true);
     }
     else
     {
         tutorialButton.SetActive(false);
     }
 }
Пример #9
0
 /// <summary>
 /// Switch the button that requests an explanation of the attacker's pieces on or off.
 /// </summary>
 /// <param name="onOrOff">Whether the button should be on (gameobject active) or off (inactive).</param>
 public virtual void ToggleExplainButton(OnOrOff onOrOff)
 {
     if (onOrOff == OnOrOff.On)
     {
         explainButton.SetActive(true);
     }
     else
     {
         explainButton.SetActive(false);
     }
 }
Пример #10
0
 /// <summary>
 /// Switch the center button, usually for undoing movement, on or off.
 /// </summary>
 /// <param name="onOrOff">Whether the button should be on (gameobject active) or off (inactive).</param>
 public virtual void ToggleUndoButton(OnOrOff onOrOff)
 {
     if (onOrOff == OnOrOff.On)
     {
         undoButton.SetActive(true);
     }
     else
     {
         undoButton.SetActive(false);
     }
 }
Пример #11
0
 /// <summary>
 /// Switch the left button, usually for ending a phase, on or off.
 /// </summary>
 /// <param name="onOrOff">Whether the button should be on (gameobject active) or off (inactive).</param>
 public virtual void TogglePhaseButton(OnOrOff onOrOff)
 {
     if (onOrOff == OnOrOff.On)
     {
         phaseOverButton.SetActive(true);
     }
     else
     {
         phaseOverButton.SetActive(false);
     }
 }
Пример #12
0
 /// <summary>
 /// Switch the tutorial text on or off.
 /// </summary>
 /// <param name="onOrOff">Whether the canvas should be on (displayed) or off (hidden).</param>
 public void ToggleTutorialText(OnOrOff onOrOff)
 {
     if (onOrOff == OnOrOff.On)
     {
         tutorialCanvas.SetActive(true);
     }
     else
     {
         tutorialCanvas.SetActive(false);
     }
 }
Пример #13
0
 public override void ToggleAllButtons(OnOrOff onOrOff)
 {
     if (onOrOff == OnOrOff.On)
     {
         titleUI.SetActive(true);
     }
     else
     {
         titleUI.SetActive(false);
     }
 }
Пример #14
0
    /// <summary>
    /// As above, but will not highlight the space if there's something in it.
    /// </summary>
    /// <param name="x">The x coordinate of the space in the grid.</param>
    /// <param name="z">The z coordinate of the space in the grid.</param>
    /// <param name="onOrOff">Should hte highlight be turned on or switched off?</param>
    /// <param name="empty"><c>true</c> if the space must be empty to be highlighted.</param>
    public void HighlightSpace(int x, int z, OnOrOff onOrOff, bool empty)
    {
        Debug.Assert(CheckValidSpace(x, z), "Attempting to highlight invalid space: x == " + x + ", z == " + z);

        if (empty &&
            onOrOff == OnOrOff.On &&
            GeneralSpaceQuery(x, z) != SpaceBehavior.ContentType.None)
        {
            return;
        }

        bool state = onOrOff == OnOrOff.On ? true : false;

        spaces[x, z].transform.Find(HIGHLIGHT_OBJ).gameObject.SetActive(state);
    }
Пример #15
0
 /// <summary>
 /// As above, but provides ability to not highlight spaces with something in them.
 /// </summary>
 /// <param name="x">The x coordinate in the grid of the central space.</param>
 /// <param name="z">The z coordinate in the grid of the central space.</param>
 /// <param name="onOrOff">Should the highlight be turned on or switched off?</param>
 /// <param name="empty"><c>true</c> if the space must be empty to be highlighted.</param>
 public void HighlightAllAroundSpace(int x, int z, OnOrOff onOrOff, bool empty)
 {
     for (int xMod = -1; xMod < 2; xMod++)
     {
         for (int zMod = -1; zMod < 2; zMod++)
         {
             if (xMod == 0 && zMod == 0)
             {
                 //don't highlight the central space
             }
             else if (CheckValidSpace(x + xMod, z + zMod))
             {
                 HighlightSpace(x + xMod, z + zMod, onOrOff, empty);
             }
         }
     }
 }
Пример #16
0
 /// <summary>
 /// Switch all audio sources controlled by the audio manager (i.e., all audio sources) on or off.
 /// </summary>
 /// <param name="onOrOff">Whether the sources should be on or off.</param>
 public void ToggleAllSound(OnOrOff onOrOff)
 {
     backgroundMusic.ToggleSound(onOrOff);
 }