Esempio n. 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        ItemPickup pickup = collision.GetComponent <ItemPickup>();

        if (pickup != null)
        {
            pickup.Pickup(this.Inventory);
        }
    }
Esempio n. 2
0
    void OnTriggerEnter(Collider collider)
    {
        ItemPickup itemPickup = collider.GetComponent <ItemPickup>();

        if (itemPickup)
        {
            itemPickup.Pickup(this);
        }
    }
Esempio n. 3
0
	void UpdateUse()
	{
		var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		RaycastHit info;

		if (Physics.Raycast(ray, out info))
		{
			ItemPickup pickup = info.collider.GetComponent<ItemPickup>();

			if (pickup)
			{
				Action move = new MoveAction(agent, info.point, animator, pickup.radius);
				Action use = move.child = new UseAnimationEventAction(animator, "use", animEvent);
				use.child = new EventAction(() => pickup.Pickup(characterInventory));

				actionContainer.SetCurrentAction(move);
			}
		}
	}