public void PickUp() { OnPickedUp(); PickedUp?.Invoke(Card); // maybe card should not directly call Card.Accept Card.Accept(); }
private void OnTriggerEnter(Collider other) { if (other.CompareTag(requiredTag)) { pickupObjectConfig.ApplyPickup(other.gameObject); PickedUp?.Invoke(); Destroy(gameObject); } }
public Task MarkAsPickedUpAsync(IEntity entityWhoPickedUp) { if (PickedUp != null) { return(PickedUp.Invoke(this, entityWhoPickedUp)); } return(Task.CompletedTask); }
public override bool PickUp(MonoBehaviour pickuper) { // If something that can be healed picked this up, heal it IHasHP toHeal = pickuper as IHasHP; bool healPickuper = toHeal != null; if (healPickuper) { toHeal.TakeHealing(healAmount); } PickedUp.Invoke(); return(true); }
private void PickUp() { var clickPosition = GetClickPosition(); var clickedItem = GetItemAt(clickPosition); if (clickedItem == null) { return; } FromPos = clickedItem.position; if (PickedUp != null) { PickedUp.Invoke(this, null); } item = clickedItem.gameObject; state = DndState.Drag; offset = FromPos - clickPosition; }
/// <summary> /// Picks up this <see cref="Entity"/>. /// </summary> /// <param name="charEntity"><see cref="CharacterEntity"/> that is trying to pick up this <see cref="Entity"/>.</param> /// <returns>True if this <see cref="Entity"/> was successfully picked up, else false.</returns> public override bool Pickup(CharacterEntity charEntity) { // Check for invalid character if (charEntity == null) { const string errmsg = "Null charEntity specified."; if (log.IsWarnEnabled) { log.Warn(errmsg); } Debug.Fail(errmsg); return(false); } // Check if the ItemEntity can be picked up if (!CanPickup(charEntity)) { return(false); } // Convert to a character var character = charEntity as Character; if (character == null) { const string errmsg = "Unable to convert CharacterEntity `{0}` to Character for some reason. " + "Is there another type, besides Character, inheriting CharacterEntity?"; if (log.IsErrorEnabled) { log.ErrorFormat(errmsg, charEntity); } Debug.Fail(string.Format(errmsg, charEntity)); return(false); } // Create a deep copy of the item to give to the character instead of giving them this item (its easier this way) var itemCopy = (ItemEntity)DeepCopy(); var amountGiven = character.GiveItem(itemCopy); // If nothing was given, then nothing happens... move on if (amountGiven <= 0) { Debug.Assert(amountGiven == 0); return(false); } // Find the new item amount var newAmount = (byte)Math.Max(Math.Min(Amount - amountGiven, byte.MaxValue), byte.MinValue); Debug.Assert(amountGiven > 0 && amountGiven <= Amount); // Update the amount property Amount = newAmount; // If all of the item was picked up, then destroy this item if (newAmount == 0) { Destroy(); } // Notify listeners using the item copy since that was the one actually given to them if (PickedUp != null) { PickedUp.Raise(itemCopy, EventArgsHelper.Create(charEntity)); } return(true); }
public virtual void OnPickedUp(PlayerEventArgs e) { AssertNotDisposed(); PickedUp?.Invoke(this, e); }
private void OnPickedUp() { PickedUp?.Invoke(this, (PointsEventArgs)EventArgs.Empty); }
public void PickUp() { Debug.Log("pick up a potion"); PickedUp?.Invoke(this); }
/// <summary> /// Gets picked up by the passed pickup-er. Returns true or false depending /// on whether the picking-up was successful. /// </summary> public virtual bool PickUp(MonoBehaviour pickuper) { PickedUp.Invoke(); return(true); }
public override void OnExit(BaseTower entity) => PickedUp.OnExit(entity);
public override void Draw(BaseTower entity) => PickedUp.Draw(entity);
public override void Update(BaseTower entity, float delta) { PickedUp.Update(entity, delta); entity.ZIndex = 10; }
protected virtual void OnPickedUp(BountyRunePickedupEventAegs e) { PickedUp?.Invoke(this, e); }
public void PickUp() { PickedUp?.Invoke(); }
private void OnPickedUp() { PickedUp?.Invoke(this, EventArgs.Empty); }