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

public class HeartSpawner : MonoBehaviour
{
    private float resetTime = 0.5f;
    private  float timer;

    private UIItemSpawner _uiItemSpawner;
    // Start is called before the first frame update
    void Start()
    {
        timer = resetTime;
        _uiItemSpawner = transform.GetComponent<UIItemSpawner>();
    }

    // Update is called once per frame
    
    void Update()
    {
        
        if (timer > 0) {
            timer -= Time.deltaTime;
            }
        if (Input.GetKeyDown("[+]") && timer <= 0)
        {
            _uiItemSpawner.SpawnEntity();
            timer = resetTime;
        }
        if (Input.GetKeyDown("[-]") && timer <= 0)
        {
            _uiItemSpawner.DespawnEntity();
            timer = resetTime;
        }
        if (Input.GetKeyDown("[*]") && timer <= 0)
        {
            _uiItemSpawner.SetAltItem(true);
            timer = resetTime;
        }
        if (Input.GetKeyDown("[/]") && timer <= 0)
        {
            _uiItemSpawner.SetAltItem(false);
            timer = resetTime;
        }
    }
}
