Collectible.cs 508 Bytes
Newer Older
1 2
using UnityEngine;
using System.Collections;
Naliwe GS committed
3
using Assets.Scripts;
4 5 6

public class Collectible : MonoBehaviour
{
Naliwe GS committed
7 8
    private GameObject _player;

9 10
    void Start()
    {
Naliwe GS committed
11
        _player = GameObject.FindWithTag("Player");
12 13 14 15 16 17 18 19
    }

    void Update()
    {
    }

    void OnTriggerEnter2D(Collider2D other)
    {
Naliwe GS committed
20
        Destroy(gameObject);
Naliwe GS committed
21
        _player.GetComponent<Player>().Score += 10;
Naliwe GS committed
22
        _player.GetComponent<Player>().Progression += 1;
Raphael committed
23
        _player.GetComponent<Player>().NbVials += 1;
24 25
    }
}