Inheritance: MonoBehaviour
コード例 #1
0
    public override void Update()
    {
        base.Update();

        if (_swipeGesture == null)
            Destroy(gameObject);

        Vector3 startPosition = _swipeGesture.StartPosition.ToUnityTranslated();
        Vector3 endPosition = _swipeGesture.Position.ToUnityTranslated();
        Vector3 offset = endPosition - startPosition;

        transform.localScale = new Vector3(offset.magnitude, 1, 1);
        transform.right = offset;
        transform.position = startPosition + offset/2;

        // Create end point on initial swipe completion
        if (_swipeGesture.State == Gesture.GestureState.STATESTOP && point2 == null) {
            GameObject go = (GameObject) GameObject.Instantiate(swipePointPrefab);
            point2 = go.GetComponent<GestureDisplay>();
            point2.gesture = _swipeGesture;
            point2.transform.position = endPosition;
        }

        //transform.position = circleGesture.Center.ToUnityTranslated();
        //transform.localScale = circleGesture.Radius * LeapManager.instance.LeapScaling * 2;
    }
コード例 #2
0
    public override void Start()
    {
        if (swipeGesture == null)
            Destroy (this);

        // Create initial point indicator
        GameObject go = (GameObject) GameObject.Instantiate(swipePointPrefab);
        go.transform.position = _swipeGesture.StartPosition.ToUnityTranslated();
        point1 = go.GetComponent<GestureDisplay>();
        point1.gesture = _swipeGesture;
        point1.transform.position = _swipeGesture.StartPosition.ToUnityTranslated();
    }