Ejemplo n.º 1
0
    //destroys the object that is grabbed when it is added to the Bag
    public void Bag(Grabdis grabdis)
    {
        InventoryResource ir = grabdis.GetComponent <InventoryResource> ();

        if (ir != null)
        {
            this.myInventory.AddResource(ir);
            Destroy(grabdis.gameObject);
        }
    }
Ejemplo n.º 2
0
 //When the object is grabbed, we can ungrab it if it is parented.
 public void Grab(Grabdis grabdis)
 {
     if (grabdis.transform.parent == this.transform)
     {
         grabdis.transform.SetParent(null);
         this.currentGrab = null;
         //Otherwise, you can grab the item and it will be parented.
     }
     else
     {
         grabdis.transform.SetParent(this.transform);
         this.currentGrab = grabdis;
     }
 }
Ejemplo n.º 3
0
 //The nearestGrab becomes what is grabbed
 public void SetNearestGrab(Grabdis grabdis)
 {
     this.nearestGrab = grabdis;
 }