Beispiel #1
0
        public override void OnWalkableLayerClick(PointerEventData data, int numCliks)
        {
            // If the handle input flag is set to false then do nothing.
            if (!handleInput || inputMode == INPUT_MODE.GAMEPAD)
            {
                return;
            }

            // The player is no longer headed for an interactable so set it to null.
            currentInteractable = null;

            // Try and find a point on the nav mesh nearest to the world position of the click and set the destination to that.
            PlayerMovement3D_PNC pmPNC = playerMovement as PlayerMovement3D_PNC;

            // Agent speed
            if (numCliks == 1)
            {
                pmPNC.agent.speed = pmPNC.walkSpeed;
            }
            else if (numCliks == 2)
            {
                pmPNC.agent.speed = pmPNC.runSpeed;
            }

            // Agent destination
            pmPNC.setDestination(pmPNC.getPointFromMesh(data.pointerCurrentRaycast.worldPosition));
        }
Beispiel #2
0
        /********************* IPointNClick Interface Methods ********************/
        public override void OnReachableInteractableClick(InteractionTrigger interactable, int numCliks)
        {
            // If the handle input flag is set to false then do nothing.
            if (!handleInput || inputMode == INPUT_MODE.GAMEPAD)
            {
                return;
            }

            // Store the interactble that was clicked on.
            if (!interactable.autoReact)
            {
                currentInteractable = interactable;
            }

            // Set the destination to the interaction location of the interactable.
            PlayerMovement3D_PNC pmPNC = playerMovement as PlayerMovement3D_PNC;

            // Agent speed
            if (numCliks == 1)
            {
                pmPNC.agent.speed = pmPNC.walkSpeed;
            }
            else if (numCliks == 2)
            {
                pmPNC.agent.speed = pmPNC.runSpeed;
            }

            // Agent destination
            pmPNC.setDestination(interactable.interactionLocation.position);
        }