Esempio n. 1
0
    // Update is called once per frame
    void Update()
    {
        maxSkillIndex = inventory.GetInventoryCount() - 1;
        ToRightSkill  = playerController.GetKeyCode("right");
        ToLeftSkill   = playerController.GetKeyCode("left");
        if (Input.GetKeyDown(ToRightSkill))
        {
            ShiftRight();
        }
        if (Input.GetKeyDown(ToLeftSkill))
        {
            ShiftLeft();
        }

        Indicate_Skill();
        inventory.setCurrentIndex(currentIndex);

        if (currentIndex == minSkillIndex)
        {
        }
        else if (currentIndex > maxSkillIndex)
        {
            currentIndex--;
        }
    }
Esempio n. 2
0
    void ActivateSkill()
    {
        if (playerInventory.GetInventoryCount() == 0)
        {
            return;
        }

        float coolDownGauge   = playerInventory.GetInventory_UIObj(_currentIndex).GetComponent <Image>().fillAmount;
        float triggerKeyValue = playerController.GetSpellTriggerKey();

        if (triggerKeyValue > 0 && triggerTemp != triggerKeyValue && coolDownGauge == 1)
        {
            playerInventory.SetAbleToUseSkillFalse(_currentIndex);
            StartCoroutine(SkillCoolDown(playerInventory.GetInventorySkill(_currentIndex).duration, _currentIndex));
            GameObject skill = Instantiate(playerInventory.GetInventorySkill(_currentIndex).spell, transform.position + new Vector3(0, 2, 0), Quaternion.identity);
            skill.GetComponent <CastingCharacter>().player = this.gameObject;
        }
        else if (Input.GetKeyDown(playerController.GetKeyCode("dropKey")))
        {
            DropSkill(_currentIndex);
        }
        triggerTemp = triggerKeyValue;
    }