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

public class ToyotaPuertasController : MonoBehaviour
{
    public Animation puerta01Animation;
    public AnimationClip puerta01Open;
    public AnimationClip puerta01Close;
    public bool puerta01Opened;

    public Animation puerta02Animation;
    public AnimationClip puerta02Open;
    public AnimationClip puerta02Close;
    public bool puerta02Opened;

    public Animation puerta03Animation;
    public AnimationClip puerta03Open;
    public AnimationClip puerta03Close;
    public bool puerta03Opened;

    public Animation puerta04Animation;
    public AnimationClip puerta04Open;
    public AnimationClip puerta04Close;
    public bool puerta04Opened;

    public void OpenClosePuerta01()
    {
        if (this.puerta01Opened)
        {
            this.puerta01Opened = false;
            this.puerta01Animation.Play(puerta01Close.name);
        }
        else
        {
            this.puerta01Opened = true;
            this.puerta01Animation.Play(puerta01Open.name);
        }
    }

    public void OpenClosePuerta02()
    {
        if (this.puerta02Opened)
        {
            this.puerta02Opened = false;
            this.puerta02Animation.Play(puerta02Close.name);
        }
        else
        {
            this.puerta02Opened = true;
            this.puerta02Animation.Play(puerta02Open.name);
        }
    }

    public void OpenClosePuerta03()
    {
        if (this.puerta03Opened)
        {
            this.puerta03Opened = false;
            this.puerta03Animation.Play(puerta03Close.name);
        }
        else
        {
            this.puerta03Opened = true;
            this.puerta03Animation.Play(puerta03Open.name);
        }
    }

    public void OpenClosePuerta04()
    {
        if (this.puerta04Opened)
        {
            this.puerta04Opened = false;
            this.puerta04Animation.Play(puerta04Close.name);
        }
        else
        {
            this.puerta04Opened = true;
            this.puerta04Animation.Play(puerta04Open.name);
        }
    }
}
