using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DildoGiftTrigger : MonoBehaviour {

	DildoGift dg;
	PlayerController pc;
	private float timer = 0;
	[SerializeField] private float maxTime = 0;
	private bool startCounting = false;

	void Start () {
		GameObject dldo = GameObject.Find ("DildoGift");
		GameObject plyer = GameObject.Find ("Player");

		pc = plyer.GetComponent<PlayerController> ();
		dg = dldo.GetComponent<DildoGift> ();
	}
	
	void Update () {
		if(startCounting)
			timer += Time.deltaTime;

		if (timer >= maxTime)
			dg.triggered = true;
	}

	void OnTriggerEnter2D(Collider2D col){
		if (!pc.isGorunded) {
			startCounting = true;
			dg.triggered = true;

		}
	}
}
