Пример #1
0
    public void OnNavigationCanceled(NavigationEventData eventData)
    {
        Debug.Log("Navigagion is canceled.");
        eventData.Use();

        //rigidbody.useGravity = true;
    }
Пример #2
0
    void INavigationHandler.OnNavigationStarted(NavigationEventData eventData)
    {
        InputManager.Instance.PushModalInputHandler(gameObject);
        eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.

        if (!isSelected)
        {
            inputSource   = eventData.InputSource;
            inputSourceId = eventData.SourceId;

            Vector3 currentHandPosition = Vector3.zero;
            InteractionSourceInfo sourceKind;
            inputSource.TryGetSourceKind(inputSourceId, out sourceKind);
            switch (sourceKind)
            {
            case InteractionSourceInfo.Hand:
                inputSource.TryGetGripPosition(inputSourceId, out currentHandPosition);
                break;

            case InteractionSourceInfo.Controller:
                inputSource.TryGetPointerPosition(inputSourceId, out currentHandPosition);
                break;
            }
            prevHandPosition = currentHandPosition;
        }
        //gameObject.SendMessageUpwards("OnSelect", SendMessageOptions.DontRequireReceiver);
    }
Пример #3
0
    void INavigationHandler.OnNavigationUpdated(NavigationEventData eventData)
    {
        Vector3[] allPoints = new Vector3[line.positionCount + 1];
        line.GetPositions(allPoints);

        float x = gameObject.transform.localPosition.x + eventData.CumulativeDelta.x;
        float y = gameObject.transform.localPosition.y + eventData.CumulativeDelta.y;
        float z = gameObject.transform.localPosition.z - 10 + eventData.CumulativeDelta.z;


        Vector3 newPoint = new Vector3(x, y, z);

        allPoints[allPoints.Length - 1] = newPoint;


        line.positionCount = allPoints.Length;
        line.SetPositions(allPoints);

        Debug.LogFormat("OnNavigationUpdated\r\nSource: {0}  SourceId: {1}\r\nCumulativeDelta: {2} {3} {4}",
                        eventData.InputSource,
                        eventData.SourceId,
                        eventData.NormalizedOffset.x,
                        eventData.NormalizedOffset.y,
                        eventData.NormalizedOffset.z);
        eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.
    }
Пример #4
0
    public void OnNavigationUpdated(NavigationEventData eventData)
    {
        InputManager.Instance.PushModalInputHandler(gameObject);

        GridParent.transform.Rotate(new Vector3(0, eventData.NormalizedOffset.x * -RotationSpeed, 0));

        eventData.Use();
    }
Пример #5
0
    // Endof InputClickerHandler Event Handler

    public void OnNavigationStarted(NavigationEventData eventData)
    {
        Debug.Log("Navigation is started.");

        InputManager.Instance.ClearModalInputStack();
        InputManager.Instance.PushModalInputHandler(this.gameObject);
        eventData.Use();
    }
Пример #6
0
    public void OnNavigationCompleted(NavigationEventData eventData)
    {
        Debug.Log("Navigation is completed.");

        InputManager.Instance.PopModalInputHandler();
        eventData.Use();

        //rigidbody.useGravity = true;
    }
Пример #7
0
 public void OnNavigationCompleted(NavigationEventData eventData)
 {
     InputManager.Instance.PopModalInputHandler();
     if (!GridParent.transform.GetComponent <WorldAnchor>())
     {
         GridParent.transform.gameObject.AddComponent <WorldAnchor>();
     }
     eventData.Use();
 }
Пример #8
0
        // .................................................................... INTERFACE IManipulationHandler


        public void OnNavigationStarted(NavigationEventData eventData)
        {
            if (isTapped)
            {
                initialEulerAngles = new Vector3();
                InputManager.Instance.PushModalInputHandler(gameObject);
                eventData.Use();
            }
        }
Пример #9
0
    void INavigationHandler.OnNavigationUpdated(NavigationEventData eventData)
    {
        if (InputManager.Instance.CheckModalInputStack(gameObject) && _gesturesManager.IsNavigating)
        {
            transform.Rotate(new Vector3(0, eventData.NormalizedOffset.x * -RotationSpeed, 0));


            eventData.Use();
        }
    }
Пример #10
0
    public void OnNavigationUpdated(NavigationEventData eventData)
    {
        Vector3 movingFactor = eventData.NormalizedOffset * MovingSensitivity * Time.deltaTime;
        Vector3 nextPos      = GetNextPosition(movingFactor);

        //rigidbody.useGravity = false;
        this.transform.position += nextPos;

        eventData.Use();
    }
Пример #11
0
 void INavigationHandler.OnNavigationStarted(NavigationEventData eventData)
 {
     Debug.LogFormat("OnNavigationStarted\r\nSource: {0}  SourceId: {1}\r\nCumulativeDelta: {2} {3} {4}",
                     eventData.InputSource,
                     eventData.SourceId,
                     eventData.NormalizedOffset.x,
                     eventData.NormalizedOffset.y,
                     eventData.NormalizedOffset.z);
     eventData.Use(); // Mark the event as used, so it doesn't fall through to other handlers.
 }
Пример #12
0
    public void OnNavigationStarted(NavigationEventData eventData)
    {
        InputManager.Instance.PushModalInputHandler(gameObject);

        if (GridParent.transform.GetComponent <WorldAnchor>())
        {
            DestroyImmediate(GridParent.transform.GetComponent <WorldAnchor>());
        }

        eventData.Use();
    }
Пример #13
0
    void INavigationHandler.OnNavigationCanceled(NavigationEventData eventData)
    {
        if (!_gesturesManager.IsNavigating)
        {
            return;
        }

        InputManager.Instance.PopModalInputHandler();
        transform.rotation = _startRotation;

        eventData.Use();
    }
Пример #14
0
    void INavigationHandler.OnNavigationCompleted(NavigationEventData eventData)
    {
        if (!InputManager.Instance.CheckModalInputStack(gameObject) || !_gesturesManager.IsNavigating)
        {
            return;
        }

        _tileParent.SnapRotation(transform);
        InputManager.Instance.PopModalInputHandler();

        eventData.Use();
    }
Пример #15
0
    void INavigationHandler.OnNavigationStarted(NavigationEventData eventData)
    {
        UIManager.Instance.SwitchState(UIManager.MenuState.Off);
        //We also check now if the entity is allowed to be rotated
        if (!_gesturesManager.IsNavigating || !_tileParent.GridTileCounterpart.Entity.AllowRotation)
        {
            return;
        }

        InputManager.Instance.PushModalInputHandler(gameObject);
        _startRotation = transform.rotation;

        eventData.Use();
    }
Пример #16
0
    public void OnNavigationUpdated(NavigationEventData eventData)
    {
        InputManager.Instance.PushModalInputHandler(gameObject);

        Vector3 scale = _startScale * (Mathf.Clamp(1 + eventData.NormalizedOffset.x, 0.2f, 3.0f));

        if (scale.x < 0.5f)
        {
            scale.x = scale.y = scale.z = 0.8f;
        }
        if (scale.x > 3.0f)
        {
            scale.x = scale.y = scale.z = 3.0f;
        }

        GridParent.transform.localScale = scale;
        eventData.Use();
    }
Пример #17
0
    public void OnNavigationUpdated(NavigationEventData eventData)
    {
        float       rotationFactor = eventData.NormalizedOffset.x * RotationSensitivity;
        BoxCollider box            = GetComponent <BoxCollider>();

        //transform.Rotate(new Vector3(0, -1 * rotationFactor, 0));
        transform.RotateAround(box.bounds.center, new Vector3(0, -1, 0), rotationFactor);
        //float scaleFactor = eventData.NormalizedOffset.x * ScaleSensitivity;
        //make sure it is not an overflow
        if (Mathf.Abs(eventData.NormalizedOffset.x) < 1 &&
            Mathf.Abs(eventData.NormalizedOffset.z) < 1)
        {
            float newScaleX = transform.localScale.x * (orignalScale + eventData.NormalizedOffset.y * ScaleSensitivity);
            float newScaleY = transform.localScale.y * (orignalScale + eventData.NormalizedOffset.y * ScaleSensitivity);
            float newScaleZ = transform.localScale.z * (orignalScale + eventData.NormalizedOffset.y * ScaleSensitivity);
            transform.localScale = new Vector3(newScaleX, newScaleY, newScaleZ);
        }
        //mark the event data to be used, why??
        eventData.Use();
    }
Пример #18
0
 void INavigationHandler.OnNavigationStarted(NavigationEventData eventData)
 {
     InputManager.Instance.PushModalInputHandler(gameObject);
     eventData.Use();
 }
Пример #19
0
 public void OnNavigationCompleted(NavigationEventData eventData)
 {
     InputManager.Instance.PopModalInputHandler();
     eventData.Use();
 }
Пример #20
0
 void INavigationHandler.OnNavigationUpdated(NavigationEventData eventData)
 {
     scrollBar.value += eventData.NormalizedOffset.x / 3f;
     eventData.Use();
 }
Пример #21
0
 void INavigationHandler.OnNavigationCanceled(NavigationEventData eventData)
 {
     InputManager.Instance.PopModalInputHandler();
     eventData.Use();
 }