}//UpdateAnimation public void SetInteractionTarget(InteractableObject obj, InteractableObject.InteractionType type = InteractableObject.InteractionType.Primary, float timeToComplete = 0f) { interactTarget = obj; interactionType = type; navAgent.SetDestination(obj.transform.position); interacting = false; interactionTime = 0f; timeToInteract = timeToComplete; }//SetInteractionTarget
public virtual void OpenInteractiveMenu(Vector3 position, InteractableObject.InteractionType type, GameObject gObj, string name) { // CloseInteractiveMenu (); currectActiveObject = gObj; open = true; currentInteractiveMenu.SetActive(true); CloseIcon(talkIconActive); CloseIcon(zoomIconActive); CloseIcon(observeIconActive); CloseIcon(pickupIconActive); CloseIcon(openIconActive); CloseIcon(leaveIconActive); CloseIcon(useIconActive); //set position on canvas currentInteractiveMenu.transform.position = WorldToGuiPoint(position); currentInteractiveMenu.gameObject.GetComponent <Animator> ().Play("MenuPopup"); GameController.instance.audioClipSource.GetComponent <AudioSource> ().clip = GameController.instance.gameSettings.clickSound4; GameController.instance.audioClipSource.GetComponent <AudioSource> ().pitch = Random.Range(0.85f, 1.15f); GameController.instance.audioClipSource.GetComponent <AudioSource> ().Play(); // get name and text component nameText = currentInteractiveMenu.GetComponent <InteractiveMenuConfig> ().nameText; name = gObj.GetComponent <InteractableObject> ().name; // Debug.Log (name); nameText.text = name.ToUpper(); //get the circles on the current menu circles = currentInteractiveMenu.GetComponent <InteractiveMenuConfig> ().circles; foreach (Image i in circles) { i.gameObject.SetActive(false); } if (type == InteractableObject.InteractionType.Observe) { numberOfMenuPoints = 2; // ShowPickup (0,gObj); ShowObserve(1, gObj); } if (type == InteractableObject.InteractionType.ObserveZoom) { ShowObserve(1, gObj); ShowZoom(0, gObj); } if (type == InteractableObject.InteractionType.ObserveUse) { ShowObserve(1, gObj); ShowUse(0, gObj); } if (type == InteractableObject.InteractionType.ObservePickup) { ShowObserve(1, gObj); ShowPickup(0, gObj); } if (type == InteractableObject.InteractionType.ObservePickupZoom) { ShowObserve(1, gObj); ShowZoom(0, gObj); ShowPickup(2, gObj); } if (type == InteractableObject.InteractionType.ObserveLeave) { ShowObserve(1, gObj); ShowLeave(0, gObj); } if (type == InteractableObject.InteractionType.ObserveOpen) { ShowObserve(1, gObj); ShowOpen(0, gObj); } }