Exemplo n.º 1
0
    public void UseItem()
    {
        if (repair.activeSelf)
        {
            Debug.Log(" using Repair");

            repair.SetActive(false);

            CheckIfAnyActive();

            playerhealth.GainHealth(30);
        }

        if (shield.activeSelf)
        {
            Debug.Log(" using Shield");

            shield.SetActive(false);

            if (singleFight != null)
            {
                RTSBattleController.shieldOn = true;

                playerController.shield.SetActive(true);

                playerController.ShieldCharge();

                playerController.shieldAnimator.SetTrigger("ShieldOn");

                playerController.shieldOnAudio.Play();

                playerController.shieldBarPanel.SetActive(true);
            }

            if (singleFight == null)
            {
                PlayerAttackScriptMultipleEnemies.shieldOn = true;

                playerController2.shield.SetActive(true);

                playerController2.ShieldCharge();

                playerController2.shieldAnimator.SetTrigger("ShieldOn");

                playerController2.shieldOnAudio.Play();

                playerController2.shieldBarPanel.SetActive(true);
            }



            CheckIfAnyActive();
        }

        if (attackPoints.activeSelf)
        {
            Debug.Log("using attackpoints");

            attackPoints.SetActive(false);

            if (singleFight == null)
            {
                battleController.attackPoints += 100;
            }

            if (singleFight != null)
            {
                battleController2.attackPoints += 100;
            }


            CheckIfAnyActive();
        }


        if (weaponBoost.activeSelf && battleController.playerTurn)
        {
            Debug.Log("using weaponBoost");

            playerController.weaponCharge.SetActive(true);
            if (singleFight != null)
            {
                RTSBattleController.weaponIsCharged = true;
            }

            if (singleFight == null)
            {
                PlayerAttackScriptMultipleEnemies.weaponIsCharged = true;
            }

            weaponBoost.SetActive(false);

            CheckIfAnyActive();
        }

        inventory.CheckAllSlotsForUse();
    }