﻿using UnityEngine;
using System.Collections;

public class ObjectsCounter : MonoBehaviour {

    private int number_of_objects;

    public int objects_quantity = 5;

    public UnityEngine.UI.Text countertext;

    public bool object_collected;

    public bool all_objects_collected;


    // Use this for initialization
    void Start () {

        number_of_objects = 0;

        object_collected = false;

        all_objects_collected = false;
	}
	
	// Update is called once per frame
	void Update () {

        if (object_collected == true)
        {
            number_of_objects++;
            object_collected = false;
        }

        if (number_of_objects >= objects_quantity)
        {
            all_objects_collected = true;
        }

        countertext.text = "x " + number_of_objects.ToString();
	
	}
}
