Exemplo n.º 1
0
 /// <summary>
 /// Adds a panel to the selected moves of a character.
 /// </summary>
 /// <param name="character">Character.</param>
 /// <param name="button">Button.</param>
 private void AddPanelToCharacterMoves(Character character, string button, int index)
 {
     //Find the panel of the character.
     foreach (SelectionPanelBahviour selectionPanel in selectedMovesPanels)
     {
         if (selectionPanel.GetOwner().Equals(character))
         {
             MovePanelBehaviour movePanel = listItems [index];
             selectionPanel.AddMove(button, movePanel.getMove());
             break;
         }
     }
 }
Exemplo n.º 2
0
    /// <summary>
    /// Clears move from any panel that has a specific move.
    /// </summary>
    /// <param name="moveName">Move name.</param>
    public void RemovePanelWithMove(string moveName)
    {
        //Cannot remove items from list while itterating.
        //Only one panel at a time can hold the same move. This fins it if it exists.
        Transform panelWithMove = null;

        foreach (Transform panel in transform)
        {
            MovePanelBehaviour panelBehaviour = panel.GetComponent <MovePanelBehaviour> ();
            Move panelMove = panelBehaviour.getMove();
            if (panelMove == null)
            {
                continue;                 // Skip panel if it does not have a move.
            }
            string panelMoveName = panelMove.GetName();
            if (panelMoveName.Equals(moveName))
            {
                panelWithMove = panel;
                break;                 //Quit loop when the correct panel is found.
            }
        }
        if (panelWithMove != null)
        {
            //Clear the panel.
            panelWithMove.GetComponent <MovePanelBehaviour>().setMove(null);
            panelWithMove.GetComponent <MovePanelBehaviour> ().RemoveSpeedText();
            panelWithMove.GetComponent <MovePanelBehaviour> ().RemoveStrengthText();
            panelWithMove.GetComponent <MovePanelBehaviour> ().RemoveNameText();
            ResetText(panelWithMove.gameObject);

            GameObject previewCharacter = panelWithMove.GetComponent <MovePanelBehaviour>().getPreviewCharacter();
            if (previewCharacter != null)
            {
                previewCharacter.SetActive(false);
                previewCharacter.GetComponent <MovePlayer>().ShowActiveBodypart(false);
                previewCharacter.GetComponent <MovePlayer>().setMoveToPlay(null);
            }
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Goes through all previously selected moves from InputSettings and selects them in the GUI.
    /// </summary>
    public void ReselectMoves()
    {
        List <string> usedButtons = InputSettings.allUsedButtons;

        //For every used button, if the move asigned to it matches that of a panel list item. Mark that list item in GUI.
        foreach (string button in usedButtons)
        {
            string buttonMoveName = InputSettings.GetMoveName(button);
            for (int i = 0; i < listItems.Length; i++)
            {
                MovePanelBehaviour listItem = listItems [i];
                Move panelMove = listItem.getMove();
                if (panelMove == null)
                {
                    continue;
                }
                if (panelMove.GetName().Equals(buttonMoveName))
                {
                    RegisterPlayerMoveToButton(button, i);
                }
            }
        }
    }