예제 #1
0
 private void FireOnItemDropped(BearItem item)
 {
     foreach (IWorldListener listener in _worldListeners)
     {
         listener.OnItemDropped(item);
     }
 }
예제 #2
0
 private void FireOnItemGrabbed(BearItem item, Player player)
 {
     foreach (IWorldListener listener in _worldListeners)
     {
         listener.OnItemGrabbed(item, player);
     }
 }
예제 #3
0
        internal BearItem PickItem(Player player)
        {
            BearItem bearItem = _bearParts.FirstOrDefault((part) =>
                                                          (Vector2.Distance(part.Position, player.Position) < _worldConfig.MaxPickDistance));

            if (bearItem == null)
            {
                return(null);
            }

            _bearParts.Remove(bearItem);
            FireOnItemGrabbed(bearItem, player);

            return(bearItem);
        }
예제 #4
0
        private void DropItem()
        {
            if (_currentItem == null)
            {
                return;
            }

            UpdateProgress();

            if (!_progressUpdated)
            {
                _world.DropItem(_currentItem);
            }

            _currentItem = null;
            FireOnItemDropped();
        }
예제 #5
0
        private void PickItem()
        {
            BearItem newItem = _world.PickItem(this);

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

            _currentItem = newItem;

            if (_currentItem == null)
            {
                return;
            }

            FireOnItemPicked();
        }
예제 #6
0
 internal void DropItem(BearItem item)
 {
     _bearParts.Add(item);
     FireOnItemDropped(item);
 }