Fixed Object Pooling and cascading
This commit is contained in:
30
Assets/Scripts/Presenter/GemPresenter.cs
Normal file
30
Assets/Scripts/Presenter/GemPresenter.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
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() {
|
||||
if (this.gemView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.gem.Position.Compare(this.gemView.transform.localPosition)) {
|
||||
this.gemView.UpdatePosition(this.gem.Position);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user