예제 #1
0
    private void OnTriggerEnter(Collider other)
    {
        PlayerStats playerStats = other.GetComponent <PlayerStats>();

        if (playerStats)
        {
            enabled = true;
            playerStats.AddBuff(_buff);
            AudioSource audio = GetComponent <AudioSource>();
            audio.Play();
        }
    }
예제 #2
0
    private void OnTriggerEnter(Collider other)
    {
        PlayerStats playerStats = other.GetComponent <PlayerStats>();

        if (playerStats)
        {
            AudioSource audio = GetComponent <AudioSource>();
            audio.PlayOneShot(pickup);
            int val = Random.Range(0, 100);
            if (val < 33)
            {
                playerStats.AddBuff(PlayerStats.Buff.Dysentery);
            }
            else if (val < 66)
            {
                playerStats.AddBuff(PlayerStats.Buff.Weakness);
            }
            else
            {
                playerStats.Heal(20);
            }
            Invoke("Destroy", 0.5f);
        }
    }