/// <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); }
/// <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); }
/// <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); } } }
/// <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); } } }
/// <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); } } }
/// <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); } }
/// <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; } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
/// <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); } }
public override void ToggleAllButtons(OnOrOff onOrOff) { if (onOrOff == OnOrOff.On) { titleUI.SetActive(true); } else { titleUI.SetActive(false); } }
/// <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); }
/// <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); } } } }
/// <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); }