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

public class ToyotaRuedasController : MonoBehaviour
{
    public Vector3 rotacion_adelante;
    public Vector3 rotacion_atras;
    public bool rodar;
    public bool adelante;
    public bool atras;

    public bool ruedaDelantera;
    public bool derecha;
    public bool izquierda;

    public GameObject root;
    public GameObject orientacion_adelante;
    public GameObject orientacion_derecha;
    public GameObject orientacion_izquierda;


    void Update()
    {
        if (this.rodar)
        {
            if (this.adelante)
            {

            }
            if (this.atras)
            {

            }
        }

        if (this.ruedaDelantera)
        {
            if (this.derecha)
            {
                this.root.transform.rotation = Quaternion.Lerp(this.root.transform.rotation, this.orientacion_derecha.transform.rotation, 0.5f);
            }
            else
            {
                if (this.izquierda)
                {
                    this.root.transform.rotation = Quaternion.Lerp(this.root.transform.rotation, this.orientacion_izquierda.transform.rotation, 0.5f);
                }
                else
                {
                    this.root.transform.rotation = Quaternion.Lerp(this.root.transform.rotation, this.orientacion_adelante.transform.rotation, 0.5f);
                }
            }
        }
    }

    public void RodarHaciaAdelante()
    {
        this.transform.Rotate(this.rotacion_adelante, Space.Self);
    }

    public void RodarHaciaAtras()
    {
        this.transform.Rotate(this.rotacion_atras, Space.Self);
    }
}

