Ejemplo n.º 1
0
    private void OnTriggerStay(Collider other)
    {
        if (Controller.triggerPressed && other.GetComponent <PickedUpItem>() && PickUpItem == null)
        {
            PickedUpItem PickObj = other.GetComponent <PickedUpItem>();
            if (!PickObj.Picking)
            {
                if (PickObj.Waiting)
                {
                    PickObj.Waiting = false;
                    SpawnBall();
                }
                PickObj.Picking = true;
                PickObj.OnPick.Invoke();
                origin_parent = PickObj.transform.parent;
                PickObj.transform.SetParent(transform);
                PickObj.transform.localPosition = Vector3.zero;
                PickObj.GetComponent <Rigidbody>().useGravity  = false;
                PickObj.GetComponent <Rigidbody>().isKinematic = true;
                PickObj.GetComponent <Rigidbody>().velocity    = Vector3.zero;
                PickObj.holding = true;
                PickUpItem      = PickObj;

                inBusy = true;
                OnCatch.Invoke();
            }
        }
    }
Ejemplo n.º 2
0
 void ReleaseItem()
 {
     PickUpItem.transform.SetParent(origin_parent);
     PickUpItem.GetComponent <Rigidbody>().useGravity  = true;
     PickUpItem.GetComponent <Rigidbody>().isKinematic = false;
     SwipeValue(PickUpItem.GetComponent <Rigidbody>());
     PickUpItem.Picking = false;
     PickUpItem.holding = false;
     PickUpItem         = null;
     inBusy             = false;
 }