public void MouseDown(MouseButton button) { if (button != MouseButton.Left || Time.GameTime.TotalGameTime.TotalSeconds < _lastPlaced + 0.5f) { return; } var itemPlacer = ItemPlacers.FirstOrDefault(x => x.PlacerFor(SelectedItem)); if (itemPlacer == null) { return; } var(i, y, _, _) = MouseState.Bounds(_camera.GetMatrix()); var mouseTileX = i / GameWorld.TileSize; var mouseTileY = y / GameWorld.TileSize; if (!itemPlacer.Place(Entity, GameWorld, SelectedItem, mouseTileX, mouseTileY)) { return; } YetiGame.ContentManager.Load <SoundEffect>("place").Play(); ItemUsed?.Invoke(SelectedItem); _lastPlaced = Time.GameTime.TotalGameTime.TotalSeconds; }
void ReleaseDesignerOutlets() { if (Calc != null) { Calc.Dispose(); Calc = null; } if (Calc != null) { Calc.Dispose(); Calc = null; } if (ItemUsed != null) { ItemUsed.Dispose(); ItemUsed = null; } if (LevelInput != null) { LevelInput.Dispose(); LevelInput = null; } if (ResultsLabel != null) { ResultsLabel.Dispose(); ResultsLabel = null; } }
/// <summary> /// Uses the item, if it can be used. /// </summary> public void Use() { if (!CanBeUsed()) { return; } // play some nice vfx to support item foreach (ParticleSystem system in _onUseVFX) { system.Play(); } UseInternal(); // instant use means cooldown starts directly after usage, otherwise cooldown starts after effect has stopped if (_model.InstantUse) { StartCooldown(); } else { _isActive = true; _remainingDuration = _model.Duration; ItemUsed?.Invoke(); } }
public static void NotifyItemUsed(ICharacter character, IItem item) { if (item == null) { Api.Logger.Error("Item is null for " + nameof(NotifyItemUsed)); return; } Api.SafeInvoke(() => ItemUsed?.Invoke(character, item)); }
public void useItem(IInventoryItem item) { //items.Remove(item); //broadcast event to the door if (ItemUsed != null) { Debug.Log("Inventory broadcasting event"); ItemUsed.Invoke(this, new InventoryEventArgs(item)); } }
public void RemoveItem(ItemUsed obj) { Product.ItemsUsed.Remove(obj); if (Product.ItemsUsed != null && Product.ItemsUsed.Count > 0) { AddTotal(obj); } else { Product.CostPrice = 0; } }
private void Use(T item) { item.Initialize(_returnToPoolDelegate); item.NextNode = null; if (item != _tailNode) { item.PreviousNode = _tailNode; _tailNode.NextNode = item; _tailNode = item; } ItemUsed?.Invoke(item); }
public async void RemoveItem(ItemUsed obj) { bool confirm = await DialogService.DisplayAlertAsync("Item Delete", "Do you want to Delete?", "Delete", "Cancel"); if (confirm) { Product.ItemsUsed.Remove(obj); if (Product.ItemsUsed != null && Product.ItemsUsed.Count > 0) { AddTotal(obj); } else { Product.CostPrice = 0; } } }
public bool UseItem(InventoryItem item) { if (Inventory.Contains(item)) { var index = Inventory.IndexOf(item); InventoryItem use = GameWorldReferenceClass.GW_Player.charInventory.Inventory.Find(x => x == item); use.usableItem.Use(GameWorldReferenceClass.GW_Player, use); if (use.currentCharges <= 0) { ItemDepleted?.Invoke(this, index); Inventory.Remove(item); return(true); } else { ItemUsed?.Invoke(this, index); return(false); } } Debug.Log("You do not have that item."); return(false); }
public async Task <int> SaveItemUsed(ItemUsed itemUsed) { try { if (App.Connection != null) { int res = 0; if (string.IsNullOrEmpty(itemUsed.Id)) { res = await App.Connection.InsertAsync(itemUsed); } else { res = await App.Connection.UpdateAsync(itemUsed); } //await App.Connection.CloseAsync(); return(res); } } catch (Exception ex) { } return(-1); }
public void useItem(IInventoryItem item) { //broadcast event to keyopener and HUDManager if (ItemUsed != null) { Debug.Log("the item is " + item.itemName); if ((item.tag == "ingredient" && cauldron.GetComponent <KeyOpener>().inRange)) { IngredientUsed.Invoke(this, new IngredientEventArgs(item.tag, item.itemImage)); items.Remove(item); } else if (item.tag == "book") { Debug.Log("Inventory broadcasting event"); ItemUsed.Invoke(this, new InventoryEventArgs(item)); items.Remove(item); } else { Debug.Log("not in range to use item"); manager.SetNotificationText("You can't use that here."); } } }
private void RaiseItemUsed(PlayerItem item) { ItemUsed?.Invoke(this, item); }
public void useItem(IInventoryItem item) { { ItemUsed.Invoke(this, new InventoryEventArgs(item)); } }
protected virtual void OnItemUsed(object source, ItemUsedEventArgs args) { ItemUsed?.Invoke(this, args); }
internal void UseItem(IInventoryItem item) { ItemUsed?.Invoke(this, new InventoryEventArgs(item)); }
/// <summary> /// Called after a player used a medical item. /// </summary> /// <param name="ev">The <see cref="UsedItemEventArgs"/> instance.</param> public static void OnItemUsed(UsedItemEventArgs ev) => ItemUsed.InvokeSafely(ev);
private void OnItemUsed(ItemInfo itemUsed) { ItemEventArgs itemEventArgs = new ItemEventArgs(itemUsed); ItemUsed?.Invoke(this, itemEventArgs); }