Esempio n. 1
0
    void Update()
    {
        Vector3 dif         = transform.position - head.transform.position;
        var     curDistance = dif.sqrMagnitude;

        if (curDistance < headDetected)
        {
            takePillsSound.Play();
            health.IncreaseHealth(inceaseAmount);
            takePillsSound.transform.parent = null;
            Destroy(gameObject);
        }
    }