using Services;
using UnityEngine;
using Utils;
using VContainer.Unity;
using Views;

namespace Presenter {
    public class GemPresenter {
        private Gem gem;
        private 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);
            }
        }
    }
}