/// <summary> /// Pickup an object or drop it, depending on state. /// </summary> void Update() { bool fist = m_animator.GetBool("Fist"); if (fist) { // Pickup object if (m_pickupObject == null && m_pickupArea != null) { this.pickupObject(); } } else { if (m_pickupObject != null) { // Drop object if (m_releaseArea != null) { m_pickupObject.ParentHand = null; m_releaseArea.receiveObject(m_pickupObject); } else { m_pickupObject.returnHome(); } PickupObject = null; } } }
// Clear all the colour, state, and receivedObjects. void resetReceived() { for (int i = 0; i < m_receivedObjects.Count; i++) { VRSimPickupObject o = m_receivedObjects[i]; if (o != null) { o.returnHome(); m_receivedObjects[i] = null; } } }
public bool receiveObject(VRSimPickupObject pickupObj) { for (int i = 0; i < AcceptList.Count; i++) { if (m_receivedObjects[i] == null && AcceptList[i].Equals(pickupObj.gameObject.name)) { m_receivedObjects[i] = pickupObj; pickupObj.transform.parent = transform; acceptAction(pickupObj); return(true); } } pickupObj.returnHome(); rejectAction(); return(false); }