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

public class Assurance : MonoBehaviour {

    public Canvas assuranceCanvas;
    public Text message; 

    private UnityEvent callback;

    private void Start()
    {
        assuranceCanvas.enabled = false;
    }

    public void Request(UnityEvent cb, string m)
    {
        assuranceCanvas.enabled = true;
        callback = cb;
        message.text = m;
    }

    public void Response(bool res)
    {
        if (res)
            callback.Invoke();
        else
            assuranceCanvas.enabled = false;
    }

    public void Reset()
    {
        callback = null;
        message.text = "";
        assuranceCanvas.enabled = false;
    }
}
