using Services;
using Utils;
using Views;

namespace Presenter {
    public class GemPresenter {
        private readonly Gem gem;
        private readonly GemView gemView;
        
        public Gem Gem => this.gem;
        public GemView GemView => this.gemView;

        public GemPresenter(Gem gem, GemView gemView) {
            this.gem = gem;
            this.gemView = gemView;
        }
        
        public void Tick(float gemSpeed) {
            if (this.gemView == null) {
                return;
            }

            if (!this.gem.Position.Compare(this.gemView.transform.localPosition)) {
                this.gemView.UpdatePosition(this.gem.Position, gemSpeed);
            }
        }
    }
}