using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SFML.Graphics;
using SFML.Window;
using YourBeatingHeart.Main.Helper;
using YourBeatingHeart.Main.Entities;

namespace YourBeatingHeart.Main.States.Play.Entities
{
    class TimerTextEntity : DrawableEntity
    {
        protected Text Text;
        protected PlayState PlayState;

        public TimerTextEntity(PlayState playState, Vector2f position, int layer)
            : base(new Text("", Constants.DEFAULT_FONT), layer)
        {
            Text = (Text) this.Drawable;
            Text.Position = position;
            PlayState = playState;
        }

        private Vector2f GetMoonPos(float _time)
        {
            return new Vector2f(960, 300);
        }

        public override void Update(float elapsedTime)
        {
            
            if (PlayState.TimeRemaining > 0)
            {
                Text.DisplayedString = GeneralHelper.MillisecondsToString(PlayState.TimeRemaining);
            }
            else
            {
                Text.DisplayedString = "Time's up!";
            }
            Text.Origin = new Vector2f(Text.GetLocalBounds().Width / 2, 0);
        }
    }
}
