private void HumanHeartCollision(GameObject heart)
 {
     if (heart.name == "HumanHeart(Clone)")
     {
         audioSource.clip = sfx.player_AddLife;
         audioSource.Play();
         playerLife.AddLife();
         Destroy(heart);
     }
 }
Ejemplo n.º 2
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow) && currentArrow > 0)
        {
            arrows[currentArrow].enabled = false;

            currentArrow--;

            arrows[currentArrow].enabled = true;
        }

        else if (Input.GetKeyDown(KeyCode.DownArrow) && currentArrow < arrows.Length - 1)
        {
            arrows[currentArrow].enabled = false;

            currentArrow++;

            arrows[currentArrow].enabled = true;
        }

        else if (Input.GetButtonDown("Fire2"))
        {
            if (currentArrow == 0 && playerCoins.coins >= int.Parse(price[0].text))
            {
                playerCoins.RemoveCoins(int.Parse(price[0].text));

                playerAttack.attackForce++;

                price[0].text = (int.Parse(price[0].text) * 2f).ToString();
            }
            else if (currentArrow == 1 && playerCoins.coins >= int.Parse(price[1].text))
            {
                playerCoins.RemoveCoins(int.Parse(price[1].text));

                playerMove.speed++;

                price[1].text = (int.Parse(price[1].text) * 2f).ToString();
            }
            else if (currentArrow == 2 && playerCoins.coins >= int.Parse(price[2].text))
            {
                playerCoins.RemoveCoins(int.Parse(price[2].text));

                playerLife.AddLife(2);

                price[2].text = (int.Parse(price[2].text) * 2f).ToString();
            }
            else if (currentArrow == 3 && playerCoins.coins >= int.Parse(price[3].text))
            {
                playerCoins.RemoveCoins(int.Parse(price[3].text));

                playerLife.Heal(playerLife.life);

                price[3].text = (int.Parse(price[3].text) * 2f).ToString();
            }
            else if (currentArrow == 4 && playerCoins.coins >= int.Parse(price[4].text))
            {
                playerCoins.RemoveCoins(int.Parse(price[4].text));

                bossDoor.OpenDoor();

                price[4].text = "0";
            }
        }
    }