示例#1
0
        private void PlantItem()
        {
            if (_currentItem == null)
            {
                StartCoroutine(TweenPinPong(DescriptionLabel.gameObject, 0.5f, 1.1f));
                return;
            }

            if (_currentItem.Amount < _maxSeeds)
            {
                StartCoroutine(TweenPinPong(RequarementAmountLabel.gameObject, 0.5f, 1.1f));
                return;
            }

            var itemType = _currentItem.Item.GetType();

            if (_currentItem.Amount <= _maxSeeds)
            {
                GameManager.PlayerModel.Inventory.RemoveItem(_currentItem);
            }
            else
            {
                _currentItem.ChangeAmount(_maxSeeds);
            }

            _currentItem = HolderObjectFactory.GetItem(itemType, _maxSeeds);

            CurrentState = GardenBedState.InProgress;
            UpdateView();

            if (_onPlantAction != null)
            {
                _onPlantAction(_currentItem);
            }
        }