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

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

            OnPickUp?.Invoke();
            Chest.Instance.Open();
        }
示例#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);
 }
 private void NotifyOnPickUp()
 {
     OnPickUp?.Invoke(this);
 }
示例#7
0
 public void PickUp()
 {
     Def.PickUp();
     OnPickUp?.Invoke(this, this);
 }
示例#8
0
 public virtual void PickUp()
 {
     PickedUp = true;
     OnPickUp?.Invoke(this);
 }
示例#9
0
 public bool PickUp(IItem item)
 {
     inventory.Add(item);
     OnPickUp?.Invoke(item);
     return(true);
 }
示例#10
0
        public void Interact()
        {
            gameObject.SetActive(false);

            OnPickUp?.Invoke(this);
        }
示例#11
0
 public void PickUp()
 {
     OnPickUp?.Invoke();
 }
示例#12
0
 private void HandlePickedUp()
 {
     IsCollected = true;
     animator.PlayCollected();
     OnPickUp?.Invoke(this);
 }