Exemplo n.º 1
0
 private void OnCollisionStay2D(Collision2D other)
 {
     if (currentAction != Actions.Holding && pick.ButtonDown && other.gameObject.tag == "Item")
     {
         //pick up a repickable item
         HeldItem = other.gameObject.GetComponent <Items.ItemBase>();
         HeldItem.Pick();
         currentAction = Actions.Holding;
     }
 }
Exemplo n.º 2
0
 private void OnTriggerStay2D(Collider2D other)
 {
     if (currentAction != Actions.Holding && pick.ButtonDown && other.tag == "ItemSpawn")
     {
         //pull an item out of ground
         HeldItem = Instantiate(other.GetComponent <Items.Grass>().item).GetComponent <Items.ItemBase>();
         HeldItem.Pick();
         Destroy(other.gameObject);
         currentAction = Actions.Holding;
     }
 }