private void FireOnItemDropped(BearItem item) { foreach (IWorldListener listener in _worldListeners) { listener.OnItemDropped(item); } }
private void FireOnItemGrabbed(BearItem item, Player player) { foreach (IWorldListener listener in _worldListeners) { listener.OnItemGrabbed(item, player); } }
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); }
private void DropItem() { if (_currentItem == null) { return; } UpdateProgress(); if (!_progressUpdated) { _world.DropItem(_currentItem); } _currentItem = null; FireOnItemDropped(); }
private void PickItem() { BearItem newItem = _world.PickItem(this); if (_currentItem != null) { DropItem(); } _currentItem = newItem; if (_currentItem == null) { return; } FireOnItemPicked(); }
internal void DropItem(BearItem item) { _bearParts.Add(item); FireOnItemDropped(item); }