public override void Initialize(Data data) { _performer = data.Performer; _controller = data.GoldBarController; _initialPosition = data.InitialPosition; IsInBag = false; Refresh(); }
private void CreateGoldBarView(GoldBarModel goldBarModel) { var goldBarController = new GoldBarController(goldBarModel); GoldBarView goldBarView; if (_goldBarsPool.Count > 0) { goldBarView = _goldBarsPool.First(); _goldBarsPool.Remove(goldBarView); } else { goldBarView = Instantiate(Resources.Load <GoldBarView>(PrefabPath.GoldBarView), transform); } var initialPosition = _fieldGrid.Grid[goldBarModel.PositionIndex]; goldBarView.gameObject.SetActive(true); goldBarView.transform.localPosition = initialPosition; goldBarView.Initialize(new GoldBarView.Data(_performer, goldBarController, initialPosition)); _goldBars.Add(goldBarModel, goldBarView); goldBarController.Listenable.AddListener <GoldBarCollected>(this); }
public CollectGold(GoldBarController goldBarController) { GoldBarController = goldBarController; }
public Data(IPerformer performer, GoldBarController goldBarController, Vector2 initialPosition) { Performer = performer; GoldBarController = goldBarController; InitialPosition = initialPosition; }