Пример #1
0
 public TreasurePool(TreasureRenderer prefab, int startingCount)
 {
     if (_treasuresPool == null)
     {
         _treasurePrefab = prefab;
         _treasuresPool  = new Pool <TreasureRenderer>(CreateTreasure, startingCount);
     }
 }
Пример #2
0
        public void SetLayer(Layer layer, int x, int y)
        {
            _backgroundRenderer.color = layer.DepthColor;
            _spriteRenderer.sprite    = layer.DecalSprite;

            if (layer.Treasure != null)
            {
                _currentTreasure = layer.Treasure.Create(x, y);

                _currentTreasure.OnCollected += layer.TreasureRemovedCallback;
                _currentTreasure.OnDropped   += ResetTreasurePosition;
                _currentTreasure.OnDropped   += HideDecal;
                _currentTreasure.OnPickUp    += ShowDecal;
                _currentTreasure.Show();

                ResetTreasurePosition();
                HideDecal();
            }
        }