Exemplo n.º 1
0
 public void InvokePickedUp(ItemEventArgs eventArgs)
 {
     holder = eventArgs.holder;
     hoverNotInteractableDescription = hoverHeldDescription;
     OnPickedUp(eventArgs);
     itemEventComponent.onPickedUp.Invoke(eventArgs);
 }
Exemplo n.º 2
0
    public void InvokeDropped(ItemEventArgs eventArgs)
    {
        var am = FindObjectOfType <AudioManager>();

        if (am)
        {
            am.PlaySound("cardDrop");
        }

        holder = null;
        hoverNotInteractableDescription = hoverOldDescription;
        OnDropped(eventArgs);
        itemEventComponent.onDropped.Invoke(eventArgs);
    }
Exemplo n.º 3
0
        // ==========

        ///
        /// On Collision with the player only
        ///
        private void OnCollisionEnter2D(Collision2D other)
        {
            if (!other.gameObject.CompareTag("Player") || !whatToPickup)
            {
                return;
            }

            // Weapon weaponScript = whatToPickup.gameObject.GetComponent<Weapon>();

            // Play sound (Played by holder)
            // weaponScript.PlayPickupAudio();

            // Send to item holder
            PlayerItemHolder holder = GameController.Instance.Player.GetComponentInChildren <PlayerItemHolder>();

            holder.ChangeItem(whatToPickup.gameObject);

            Destroy(gameObject);
        }
Exemplo n.º 4
0
    protected override void OnInteract(InteractEventArgs eventArgs)
    {
        if (holder)
        {
            holder.DropItem();
        }

        holder = eventArgs.hand.GetComponent <PlayerItemHolder>();
        try
        {
            holder.PickUpItem(this);

            var am = FindObjectOfType <AudioManager>();
            if (am)
            {
                am.PlaySound("cardPickup");
            }
        }
        catch
        {
            holder = null;
            throw;
        }
    }
Exemplo n.º 5
0
 public ItemEventArgs(PlayerItemHolder holder)
 {
     this.holder = holder;
 }
Exemplo n.º 6
0
        // =================


        private void Awake()
        {
            _holder = GetComponentInChildren <PlayerItemHolder>();
        }