﻿using UnityEngine;
using System.Collections;

public class DoorClick : Clickable {

    private bool open = false;
    private Animator doorAnims;
    public string openText;
    public string closeText;

    public void Start()
    {
        doorAnims = this.GetComponent<Animator>();
    }

    public override void PerformAction(Collider player)
    {
        if (doorAnims.GetBool("Open"))
        {
            doorAnims.SetBool("Open", false);
        }
        else
        {
            doorAnims.SetBool("Open", true);
        }
        open = !open;
    }

    public override void HoverPrompt()
    {
        if (doorAnims.GetBool("Open")) 
        {
            base.HoverPrompt(closeText);
        }
        else
        {
            base.HoverPrompt(openText);
        }
    }
}
