Exemplo n.º 1
0
 public void ConfirmSelection()
 {
     ps.powerOrbs     -= 1;
     orbCountText.text = "Orbs of Power: " + ps.powerOrbs;
     confirmationWindow.SetActive(false);
     Debug.Log("You Bought " + ability);
     //Adding the ability to your learned abilities list
     am.learnedAbilities.Add(ability.gameObject);
     currentPurchaseSlot.SendMessage("LearnThisAbility");
     //once done adding, refresh the selection menu
     abUI.UpdateUiAbilities();
     StartCoroutine(OnMenuOpen());//closes the window
 }
Exemplo n.º 2
0
    public void LeftInput(InputAction.CallbackContext context)
    {
        if (!ph.isDead && !talking && !pm.knockback)
        {
            if (context.performed) //This if(context.performed) seems to be required, or else the input will call started, performed, and canceled.
            {                      //This could also be useful for charging up attacks by checking both performed and canceled.
                abOneHold = true;
                if (!usingAbility && !gh.abilityEditing)
                {
                    //play an animation, like the button getting pressed
                    if (abMaskOne.enabled == false)
                    {
                        currentAbility = 1;
                        abilityOne     = activeAbilities[0];
                        abOneName      = abilityOne.name;
                        abOneScript    = abilityOne.GetComponent(abOneName);
                        abOneScript.SendMessage("UseAbility", currentAbility);
                        return;
                    }
                }
                if (gh.abilityEditing)
                {
                    activeAbilities[0] = EventSystem.current.currentSelectedGameObject.transform.parent.gameObject.GetComponent <AbilitySlot>().ability;//this find the current selected ability in the UI. Assign this to the correct active abilities slot
                    //lastly Update

                    abUIPanel.UpdateUiAbilities();
                    return;
                }
            }
            if (context.canceled && !gh.abilityEditing)
            {
                abOneHold = false;
                abOneScript.SendMessage("EndAbility");
            }
        }
    }