using System.Threading.Tasks;
using UnityEngine;

public class EventControls
{
    public static EventControls Instance;

    private Camera laughingCamera;
    private GameObject Marti;

    public EventControls(Camera laughingCamera, GameObject Marti)
    {
        this.laughingCamera = laughingCamera;
        this.Marti = Marti;
        Instance = this;
    }

    public async Task Laugh()
    {
        Marti.GetComponent<MartiController>().CanMove = false;
        laughingCamera.enabled = true;
        Marti.GetComponent<AudioSource>().Play();
        Time.timeScale = 0f;
        Marti.GetComponent<Animator>().SetTrigger("Laugh");
        await Task.Delay(2000);
        Time.timeScale = 1f;
        laughingCamera.enabled = false;
        Marti.GetComponent<MartiController>().CanMove = true;
    }

    public async Task KissEventSuccess(Camera kissEventCamera)
    {
        Marti.GetComponent<BarController>().CurrentMoral += 10;
        Marti.GetComponent<MartiController>().CanMove = false;
        kissEventCamera.enabled = true;
        Time.timeScale = 0f;
        await Task.Delay(1000);
        Time.timeScale = 1f;
        kissEventCamera.enabled = false;
        await Laugh();
        Marti.GetComponent<MartiController>().CanMove = true;
    }
}
