コード例 #1
0
        public override void Initialize(Data data)
        {
            _performer       = data.Performer;
            _controller      = data.GoldBarController;
            _initialPosition = data.InitialPosition;

            IsInBag = false;

            Refresh();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public CollectGold(GoldBarController goldBarController)
 {
     GoldBarController = goldBarController;
 }
コード例 #4
0
 public Data(IPerformer performer, GoldBarController goldBarController, Vector2 initialPosition)
 {
     Performer         = performer;
     GoldBarController = goldBarController;
     InitialPosition   = initialPosition;
 }