﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace Tap.Tilt
{
    public class PlayerPoints : ObjectController
    {
        public int rewardPoints = 1;
        public float cooldown = 1f;

        private float nextReward;
        public override void TouchInput(ControlData controlData)
        {
            string touchType = controlData.type;

            // exit if inside cooldown
            if (nextReward > Time.time)
                return;

            // touchType will be touchstart, touchend, touchcancel, or touchmove
            if (touchType == "touchstart")
            {
                nextReward = Time.time + cooldown;
                GameController.instance.UserPoints(controlData.i, rewardPoints);
            }
            
        }

    }
}