Example #1
0
    //-------------------------
    void OnTriggerEnter(Collider Col)
    {
        //If player collected coin, then destroy object
        if (Col.CompareTag("Player"))
        {
            SoundPlay.PlaySound();
            Destroy(gameObject);
            Timer.CountDown = Timer.CountDown + 10;
        }

        else
        {
            Debug.Log("ROAR");
            transform.position = new Vector3(Random.Range(-120.0F, 3.0F), 1, Random.Range(-30.0F, 30.0F));
        }
    }