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

public class FixVase : MonoBehaviour
{
    public VasePiece[] pieces;
    public AudioClip clip;
    private AudioSource source;
    private float fixTime = 2f;

    private void Awake()
    {
        source = GetComponent<AudioSource>();
    }

    public void Fix()
    {
        // Loop through, and if enabled, do something
        // If holding a piece, that piece leaves you
        // Snap player to look at vase?
        GrabManager.heldItem = true; // to prevent more interactions
        GridHighlighter.instance.DisableHighlights();
        GridHighlighter.DISABLED = true;

        for (int i = 0; i < pieces.Length; i++)
        {
            VasePiece curPiece = pieces[i];
            curPiece.SetGrab(false);
            curPiece.LerpToOriginalPosOverTime(fixTime);
        }

        source.Stop();
        source.volume = 0.5f;
        source.clip = clip;
        source.Play();
    }
}