Exemplo n.º 1
0
 public void PickUp()
 {
     GameHandler.inventory.Add(item);
     gameObject.SetActive(false);
     onPickUp.Invoke();
     GameHandler.soundHandler.pickup.Play();
 }
Exemplo n.º 2
0
    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);
        }
    }
Exemplo n.º 3
0
 public void PickUp(Rigidbody2D rigidbody)
 {
     OnPickUp.Invoke();
     pickUpAnimator.SetTrigger("PickUp");
     AddForceBoost(rigidbody);
     freezeManager.Freeze(freezeTime);
     StartCoroutine(Respawn());
 }
Exemplo n.º 4
0
        private void OnMouseDown()
        {
            _dragging = true;

            transform.localScale = Vector3.one * _sizeCoefficient;
            _material.SetFloat("_Highlight", 1f);
            _collider.enabled = false;

            OnPickUp?.Invoke();
            Chest.Instance.Open();
        }
Exemplo n.º 5
0
 public bool Add(Item item)
 {
     if (items.Count >= space)
     {
         Debug.Log("Not enough room.");
         return(false);
     }
     items.Add(item);
     pickUp.Invoke(item);
     return(true);
 }
Exemplo n.º 6
0
 private void NotifyOnPickUp()
 {
     OnPickUp?.Invoke(this);
 }
Exemplo n.º 7
0
 public void PickUp()
 {
     Def.PickUp();
     OnPickUp?.Invoke(this, this);
 }
Exemplo n.º 8
0
 public virtual void PickUp()
 {
     PickedUp = true;
     OnPickUp?.Invoke(this);
 }
Exemplo n.º 9
0
 public bool PickUp(IItem item)
 {
     inventory.Add(item);
     OnPickUp?.Invoke(item);
     return(true);
 }
Exemplo n.º 10
0
        public void Interact()
        {
            gameObject.SetActive(false);

            OnPickUp?.Invoke(this);
        }
Exemplo n.º 11
0
 public void PickUp()
 {
     OnPickUp?.Invoke();
 }
Exemplo n.º 12
0
 private void HandlePickedUp()
 {
     IsCollected = true;
     animator.PlayCollected();
     OnPickUp?.Invoke(this);
 }