public void PickUp() { GameHandler.inventory.Add(item); gameObject.SetActive(false); onPickUp.Invoke(); GameHandler.soundHandler.pickup.Play(); }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { if (collided) { return; } collided = true; col.enabled = false; anim.SetTrigger("pickUp"); source.Play(); switch (itemType) { case ItemType.Gem: OnPickUp?.Invoke(1); break; case ItemType.Cherry: OnPickUp?.Invoke(2); break; } Destroy(gameObject, 0.267f); } }
public void PickUp(Rigidbody2D rigidbody) { OnPickUp.Invoke(); pickUpAnimator.SetTrigger("PickUp"); AddForceBoost(rigidbody); freezeManager.Freeze(freezeTime); StartCoroutine(Respawn()); }
private void OnMouseDown() { _dragging = true; transform.localScale = Vector3.one * _sizeCoefficient; _material.SetFloat("_Highlight", 1f); _collider.enabled = false; OnPickUp?.Invoke(); Chest.Instance.Open(); }
public bool Add(Item item) { if (items.Count >= space) { Debug.Log("Not enough room."); return(false); } items.Add(item); pickUp.Invoke(item); return(true); }
private void NotifyOnPickUp() { OnPickUp?.Invoke(this); }
public void PickUp() { Def.PickUp(); OnPickUp?.Invoke(this, this); }
public virtual void PickUp() { PickedUp = true; OnPickUp?.Invoke(this); }
public bool PickUp(IItem item) { inventory.Add(item); OnPickUp?.Invoke(item); return(true); }
public void Interact() { gameObject.SetActive(false); OnPickUp?.Invoke(this); }
public void PickUp() { OnPickUp?.Invoke(); }
private void HandlePickedUp() { IsCollected = true; animator.PlayCollected(); OnPickUp?.Invoke(this); }