Beispiel #1
0
        private void Catch(Catchable catchable)
        {
            var newPosition       = new Vector3();
            var catchableCollider = catchable.GetComponent <BoxCollider>();

            if (catchableCollider != null)
            {
                newPosition.y = catchableCollider.size.y / 2;
                newPosition.z = catchableCollider.size.z / 2;
            }

            _takenObject = catchable.GetComponent <Catchable>().Catch(
                ObjectPosition,
                newPosition,
                new Quaternion());
        }
Beispiel #2
0
 /// <summary>
 /// drop catchable
 /// </summary>
 /// <param name="item">catchable to drop</param>
 public void Drop(Catchable item)
 {
     if (item == null)
     {
         return;
     }
     item.transform.parent = GameManager.AssetsManager.InteractiveTransform;
     item.GetComponent <Collider2D>().enabled = true;
 }
Beispiel #3
0
 /// <summary>
 /// Add catchable to the inventory
 /// </summary>
 /// <param name="item">catchable to add</param>
 public void Add(Catchable item)
 {
     if (item == null)
     {
         return;
     }
     item.transform.parent                    = InventoryTransform;
     item.transform.localPosition             = new Vector3();
     item.GetComponent <Collider2D>().enabled = false;
     AddConsumable(item as Consumable);
     AddPassive(item as Passive);
     AddEquipment(item as Equipment);
 }