private void RemoveItem(bool stillTouching = false) { if (stillTouching) { //when let got of adjustable object will still be touching it after controllerCarryState = CarryingState.Touching; pointCloudObjects.ReleaseObject(); pointCloudObjects = null; } else { controllerCarryState = CarryingState.Empty; HeldItemDescription.ClearDescription(); MarkerColor.ResetColor(); currentObject = null; if (interactiveObject != null) { interactiveObject.ObjectReleased(); interactiveObject = null; } if (generalObject != null) { generalObject.ObjectReleased(); generalObject = null; } } }
private void HandleTriggerClicked(object sender, ClickedEventArgs e) { if (controllerCarryState == CarryingState.Touching) { //find which object it is if (currentObject.tag == "CollectableItem") { interactiveObject = currentObject.GetComponent <InteractiveObject>(); } if (currentObject.tag == "GeneralItem") { generalObject = currentObject.GetComponent <GeneralObjectInteractivity>(); } controllerCarryState = CarryingState.Holding; //is held by other controller if (currentObject.transform.parent.tag == "GameController") { if (interactiveObject != null) { interactiveObject.ObjectTransferred(transform); } else if (generalObject != null) { generalObject.ObjectTransferred(transform); } } else //can be picked up, TODO: see about playing each objects audio clip once if required { if (interactiveObject != null) { interactiveObject.ObjectPickedUp(transform); AudioPlayer.PlayAudioClip(interactiveObject.voiceOver); } else if (generalObject != null) { generalObject.ObjectPickedUp(transform); AudioPlayer.PlayAudioClip(generalObject.voiceOver); } } } }