using UnityEngine;
using System.Collections;
using Framework.Entities;
using Framework.Utility;

public class BedResponsive : Responsive
{
    private bool responding = false;
    private UnityTimer respondTimer = new UnityTimer(3f, false);

    protected override void InnerAwake()
    {
        base.InnerAwake();
        if (this.displayName == "")
        {
            this.displayName = "Bed";
        }
    }

    protected override void InnerUpdate()
    {
        if (responding)
        {
            respondTimer.Advance();
            if (respondTimer.IsComplete())
            {
                Announce(new DayDirector.EndDayAction());
                respondTimer.Reset();
                responding = false;
                Announce(new AlchemistPlayerInput.UnfreezeAction());
            }
        }
    }


    protected override void Respond(RespondAction action)
    {
        responding = true;
        Announce(new AlchemistPlayerInput.FreezeAction());
        Announce(new FadeDisplay.FadeInAction(this.respondTimer.GetEnd()));
    }
}