﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;


public class CalibrationManette : MonoBehaviour , GestionnaireCalibrations.ICalibration {

    public Transform RepereCalibre = null;
    public TextMeshPro Texte = null;
    public Transform PorteTexte = null;

   // Update is called once per frame
   public  IEnumerator Calibration()
    {
        if (PorteTexte == null ) { yield break; }
        if (Texte == null) { yield break; }
        if (RepereCalibre == null) { yield break; }

        Debug.Log("Calibration, attente de A");
        PorteTexte.gameObject.SetActive(true);
       
        while (!Input.GetButton("A_1"))
        {
            PorteTexte.rotation = transform.parent.rotation;
            PorteTexte.position = transform.position;
            PorteTexte.Translate(Vector3.forward * 1.0f);
            yield return null;
        }

        RepereCalibre.rotation = transform.parent.rotation;
        RepereCalibre.position = transform.position;
    
        PorteTexte.gameObject.SetActive(false);
        Debug.Log("Fin de calibration");

    }

}
