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

public class Curtains : Singleton<Curtains> {

    public bool IsOpen = false;

    [SerializeField] private Animator animator;
    [SerializeField] private AudioSource source;
    [SerializeField] private AudioClip curtainSound;

    public void Open() {//
        if (!IsOpen) {
            animator.SetTrigger("Open");
            AudioManager.Instance.Play(GameManager.Instance, "Curtains", false, 1f);
            //source.clip = curtainSound;
            //source.Play();
            AudioManager.Instance.PlayAtmosphere("GameTheme");
        }
    }

    public void Close() {
        if (IsOpen) {
            animator.SetTrigger("Close");
            source.clip = curtainSound;
            source.Play();
        }
    }
}
