// if the claw has a targeted object and it has finished dropping, we parent the object to the claw // and tell the object to move where the claw is. private void grabTargetedObject() { if (CurrentTargetedObject != null) { CurrentTargetedObject.gameObject.transform.parent = this.transform; CurrentTargetedObject.transform.position = new Vector3(this.transform.position.x, this.transform.position.y - DesiredYCoordinate, this.transform.position.z); // CurrentTargetedObject.TopOfCrate CurrentTargetedObject.LiftObject(); } }
// drops our lifted object, unparenting it and letting it fall to the ground. private void dropHeldObject() { CurrentTargetedObject.DropObject(); CurrentTargetedObject.gameObject.transform.parent = null; CurrentTargetedObject = null; }