Ejemplo n.º 1
0
 public void AddLife()
 {
     if (Input.GetKeyDown(KeyCode.Y))
     {
         health.Health();
     }
 }
Ejemplo n.º 2
0
    public void FirstAid()
    {
        if (itemSelected == 1 && itemsCount[1] > 0 && player.life.health < 100)
        {
            if (pressed && realised != 1)
            {
                if (!firstTime)
                {
                    healing = true;

                    Debug.Log("F");
                    //audPlay.Play(3, 1, Random.Range(0.95f, 1.05f));
                    if (ClipsSelected.clips[itemSelected] != null && baseSource != null)
                    {
                        baseSource.ChangePitchAndVolume(0.7f, 1, 0.95f, 1.05f);
                        baseSource.PlayOneShot(ClipsSelected.clips[itemSelected]);
                    }

                    firstAidVisuals[visualItemsCount[itemSelected] - 1].SetActive(false);

                    visualItemsCount[1]--;

                    firstTime = true;
                }

                if (healing)
                {
                    if (TimeCounter >= timeFirstAid)
                    {
                        Debug.Log("Healed");
                        //healthAnim.SetBool("Health", false);

                        player.anims.SetAnimLaunch();

                        TimeCounter = 0;

                        peace.Health();

                        if (baseSource != null)
                        {
                            baseSource.Stop();
                        }

                        //audPlay.Play(4, 1, Random.Range(0.95f, 1.05f));
                        if (ClipsLaunched.clips[itemSelected] != null)
                        {
                            baseSource.ChangePitchAndVolume(0.7f, 1, 0.95f, 1.05f);
                            baseSource.PlayOneShot(ClipsLaunched.clips[itemSelected]);
                        }

                        pressed = false;

                        itemsCount[1]--;

                        CantGunCantItem(false, false, false);
                    }
                    else
                    {
                        TimeCounter += Time.deltaTime;
                        //healthAnim.SetBool("Health", true);
                    }
                }
            }
        }
    }