Ejemplo n.º 1
0
    public void AbilityCallbackMenu(Defs.PlayerClass playerClass, Vector3 usedSlots, bool[] unavailableAbilities, int[] equippedAbilities)
    {
        //Character
        characterMenu.alpha = 0;

        //Abilities
        abilityMenu.alpha          = 1;
        abilityMenu.interactable   = true;
        abilityMenu.blocksRaycasts = true;

        //Class
        abilityMenu.transform.GetChild(0).GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = playerClass.ToString();
        Vector3 availableSlots = PlayerCore.PlayerClassToSlots(playerClass);
        int     workingIndex   = 0;

        for (int red = 0; red < availableSlots.x; red++)
        {
            abilityMenu.transform.GetChild(0).GetChild(0).GetChild(workingIndex + 1).GetComponent <Image>().color = Color.red;
            if (red < usedSlots.x)
            {
                abilityMenu.transform.GetChild(0).GetChild(0).GetChild(workingIndex + 1).GetChild(0).GetComponent <Image>().color = Color.red;
            }
            workingIndex++;
        }

        for (int blue = 0; blue < availableSlots.y; blue++)
        {
            abilityMenu.transform.GetChild(0).GetChild(0).GetChild(workingIndex + 1).GetComponent <Image>().color = Color.blue;
            if (blue < usedSlots.y)
            {
                abilityMenu.transform.GetChild(0).GetChild(0).GetChild(workingIndex + 1).GetChild(0).GetComponent <Image>().color = Color.blue;
            }
            workingIndex++;
        }

        for (int green = 0; green < availableSlots.z; green++)
        {
            abilityMenu.transform.GetChild(0).GetChild(0).GetChild(workingIndex + 1).GetComponent <Image>().color = Color.green;
            if (green < usedSlots.z)
            {
                abilityMenu.transform.GetChild(0).GetChild(0).GetChild(workingIndex + 1).GetChild(0).GetComponent <Image>().color = Color.green;
            }
            workingIndex++;
        }

        //Abilities
        for (int count = 0; count < unavailableAbilities.Length; count++)
        {
            Transform target = abilityMenu.transform.GetChild(0).GetChild(2).GetChild(count).GetChild(0);

            if (unavailableAbilities[count])
            {
                target.GetComponent <Image>().color = new Color(1, 1, 1, 0.3f);
                target.GetComponent <AbilityUpgradeSlot>().canUse = false;
            }
            else
            {
                target.GetComponent <Image>().color = Color.white;
                target.GetComponent <AbilityUpgradeSlot>().canUse = true;
            }
        }

        //ActionBar
        for (int count = 0; count < equippedAbilities.Length; count++)
        {
            Transform target = abilityMenu.transform.GetChild(0).GetChild(4).GetChild(count);
            if (equippedAbilities[count] == -1)
            {
                target.GetChild(0).GetComponent <Image>().sprite = abilityDefault;
            }
            else
            {
                target.GetChild(0).GetComponent <Image>().sprite = abilitySheet.contained[equippedAbilities[count]].image;
                target.GetChild(1).GetComponent <Animator>().SetTrigger("Ready");
            }
        }
    }
Ejemplo n.º 2
0
    public void MenuCallbackAbilitiesInfo(int skillpoints, int level, float xp, float xpMax, Defs.PlayerClass playerClass, Vector3 usedSlots)
    {
        //Character
        characterMenu.alpha          = 1;
        characterMenu.blocksRaycasts = true;
        characterMenu.interactable   = true;

        //Class
        menuAbilities.transform.GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = playerClass.ToString();
        Vector3 availableSlots = PlayerCore.PlayerClassToSlots(playerClass);
        int     workingIndex   = 0;

        for (int red = 0; red < availableSlots.x; red++)
        {
            menuAbilities.transform.GetChild(0).GetChild(workingIndex + 1).GetComponent <Image>().color = Color.red;
            if (red < usedSlots.x)
            {
                menuAbilities.transform.GetChild(0).GetChild(workingIndex + 1).GetChild(0).GetComponent <Image>().color = Color.red;
            }
            workingIndex++;
        }

        for (int blue = 0; blue < availableSlots.y; blue++)
        {
            menuAbilities.transform.GetChild(0).GetChild(workingIndex + 1).GetComponent <Image>().color = Color.blue;
            if (blue < usedSlots.y)
            {
                menuAbilities.transform.GetChild(0).GetChild(workingIndex + 1).GetChild(0).GetComponent <Image>().color = Color.blue;
            }
            workingIndex++;
        }

        for (int green = 0; green < availableSlots.z; green++)
        {
            menuAbilities.transform.GetChild(0).GetChild(workingIndex + 1).GetComponent <Image>().color = Color.green;
            if (green < usedSlots.z)
            {
                menuAbilities.transform.GetChild(0).GetChild(workingIndex + 1).GetChild(0).GetComponent <Image>().color = Color.green;
            }
            workingIndex++;
        }

        //Level
        menuAbilitiesLevelFill.fillAmount = xp / xpMax;
        if (level != 5)
        {
            menuAbilitiesLevelText.text = "Level " + level + " (" + Mathf.Clamp(xp, 0, xpMax).ToString("F0") + " / " + xpMax.ToString("F0") + ")";
        }
        else
        {
            menuAbilitiesLevelText.text = "Max Level";
        }

        //Points
        if (skillpoints == 0)
        {
            menuAbilitiesAP.text = "<color=#787878>0";
        }
        else
        {
            menuAbilitiesAP.text = "<color=yellow>" + skillpoints;
        }

        //Button
        if (skillpoints == 0)
        {
            menuAbilitiesLearn.interactable = false;
        }
        else
        {
            menuAbilitiesLearn.interactable = true;
        }
    }