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

public class TypeRepair : MonoBehaviour
{
    public GameObject bridges,transparantBridges;
    public static bool canMash = true;
    public int mashIndex = 0;
    public static float typeBarAmount = 0f;
    public float typeBarAmountPlus = 0.02f;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (typeBarAmount >= 1f)
        {
            canMash = false;
            typeBarAmount = 0.99f;
            bridges.transform.GetChild(mashIndex).gameObject.SetActive(true);

            // GameObject.Find("AudioManager").GetComponent<AudioManager>().PlayAudio(0,false,false);
            Debug.Log("Play Audio");
            
            mashIndex++;
            print(typeBarAmount);
        }
        if (canMash)
        {

            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (typeBarAmount < 1f) typeBarAmount += typeBarAmountPlus;
            }
        }      
    }

    public void NextBridge()
    {
        print("nextbridge");
        transparantBridges.transform.GetChild(mashIndex).gameObject.SetActive(true);
    }
}
