public void OnFingerSwipe(Lean.LeanFinger finger)
    {
        // Make sure the info text exists
        if (InfoText != null)
        {
            // Store the swipe delta in a temp variable
            var swipe = finger.SwipeDelta;

            if (swipe.x < -Mathf.Abs(swipe.y))
            {
                InfoText.text = "You swiped left!";
            }

            if (swipe.x > Mathf.Abs(swipe.y))
            {
                InfoText.text = "You swiped right!";
            }

            if (swipe.y < -Mathf.Abs(swipe.x))
            {
                InfoText.text = "You swiped down!";
            }

            if (swipe.y > Mathf.Abs(swipe.x))
            {
                InfoText.text = "You swiped up!";
            }
        }
    }
Exemplo n.º 2
0
    void Start()
    {
        // Link to LeanTouch events
        LeanTouch.OnFingerDown += OnFingerDown;
        LeanTouch.OnFingerUp += OnFingerUp;
        LeanTouch.OnSoloDrag += OnSoloDrag;
        LeanTouch.OnMultiDrag += OnMultiDrag;
        currFinger = null;

        // Initialize LineRenderer
        lineGameObject = new GameObject("SlashLine");
        lineGameObject.AddComponent<LineRenderer>();

        lineRenderer = lineGameObject.GetComponent<LineRenderer>();
        lineRenderer.material = new Material(Shader.Find("Mobile/Particles/Additive"));
        lineRenderer.SetColors(c0, c1);
        lineRenderer.SetWidth(0.1f, 0f);
        lineRenderer.SetVertexCount(0);

        // Initialize other variables
        i = 0;
        slashing = false;
        soloDragging = false;
        currSoloDragDelta = Vector2.zero;

        // Init GM ref
        GM = GameObject.Find("GameManager").GetComponent<GameManager>();
    }
Exemplo n.º 3
0
    public void OnFingerTap(Lean.LeanFinger finger)
    {
        // Does the prefab exist?
        if (Prefab != null)
        {
            // Make sure the finger isn't over any GUI elements
            if (finger.IsOverGui == false)
            {
                Debug.Log("Letter A");
                // Clone the prefab, and place it where the finger was tapped
                var position = finger.GetWorldPosition(50.0f);
                var rotation = Quaternion.identity;
                var clone    = (GameObject)Instantiate(Prefab, position, rotation);

                // Make sure the prefab gets destroyed after some time
                Destroy(clone, 2.0f);
            }
            else
            {
                Debug.Log("Letter B");
            }
        }
        else
        {
            Debug.Log("Letter C");
        }
    }
Exemplo n.º 4
0
 public void OnFingerUp(Lean.LeanFinger pFinger)
 {
     if (pFinger == pDraggingFinger_)
     {
         CancelSelectBlock();
     }
 }
    public void OnFingerTap(Lean.LeanFinger finger)
    {
        Vector2 referencePoint = new Vector2();

        referencePoint.x = 0.0f;
        referencePoint.y = 0.0f;
        if (finger.GetDistance(referencePoint) < 200.0)
        {
            foreach (GameObject obj in onTapDisplays)
            {
                obj.SetActive(!obj.activeSelf);
            }
        }


        // Does the prefab exist?
        if (Prefab != null)
        {
            // Make sure the finger isn't over any GUI elements
            if (finger.IsOverGui == false)
            {
                // Clone the prefab, and place it where the finger was tapped
                var position = finger.GetWorldPosition(50.0f);
                var rotation = Quaternion.identity;
                var clone    = (GameObject)Instantiate(Prefab, position, rotation);

                // Make sure the prefab gets destroyed after some time
                Destroy(clone, 2.0f);
            }
        }
    }
    public void OnFingerSwipe(Lean.LeanFinger finger)
    {
        // Make sure the info text exists
        //if (InfoText != null)
        //{
        // Store the swipe delta in a temp variable
        var swipe = finger.SwipeDelta;

        if (swipe.x < -Mathf.Abs(swipe.y))
        {
            thePlayer.transform.Rotate(new Vector3(0, 90, 0));
            //InfoText.text = "You swiped left!";
        }

        if (swipe.x > Mathf.Abs(swipe.y))
        {
            thePlayer.transform.Rotate(new Vector3(0, -90, 0));
            //InfoText.text = "You swiped right!";
        }

        if (swipe.y < -Mathf.Abs(swipe.x))
        {
            //InfoText.text = "You swiped down!";
        }

        if (swipe.y > Mathf.Abs(swipe.x))
        {
            //InfoText.text = "You swiped up!";
        }
        //}
    }
Exemplo n.º 7
0
 public void OnFingerTap(Lean.LeanFinger finger)
 {
     Debug.Log("DEM TAPS");
     // Does the prefab exist?
     if (Prefab != null)
     {
         // Make sure the finger isn't over any GUI elements
         if (finger.IsOverGui == false)
         {
             /*
              * // Clone the prefab, and place it where the finger was tapped
              * var position = finger.GetWorldPosition(10.0f);
              * var rotation = Quaternion.identity;
              * var clone    = (GameObject)Instantiate(Prefab, position, rotation);
              *
              * // Make sure the prefab gets destroyed after some time
              * Destroy(clone, 2.0f);
              */
         }
         else
         {
             if (finger.WhatTouched() == IgnoredObject)
             {
                 var position = new Vector3(finger.ScreenPosition.x, 0.0f, finger.ScreenPosition.y);
                 var rotation = Quaternion.identity;
                 var clone    = (GameObject)Instantiate(Prefab, position, rotation);
                 Destroy(clone, 2.0f);
             }
         }
     }
 }
Exemplo n.º 8
0
    public void OnFingerDown(Lean.LeanFinger finger)
    {
        //Debug.Log("OnFingerDown called by " + gameObject.name);
        // Raycast information
        Ray        ray = finger.GetRay(CameraToUse);
        RaycastHit hit;

        //Debug.DrawRay(CameraToUse.transform.position, CameraToUse.transform.forward, Color.green, 10, true);

        //Debug.Log(ray.origin);
        //Debug.Log(transform.position + "HI");

        // Was this finger pressed down on a collider?

        if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask) == true)
        {
            //Debug.Log(hit.transform.name);
            // Was that collider this one?
            if (hit.collider.gameObject == gameObject)
            {
                //Debug.Log("Touched " + hit.collider.gameObject.name);
                // Set the current finger to this one
                draggingFinger = finger;
            }
        }
    }
Exemplo n.º 9
0
    public void OnFingerTap(Lean.LeanFinger finger)
    {
        // Does the prefab exist?
        if (Prefab != null)
        {
        }

        // Make sure the finger isn't over any GUI elements
        if (finger.IsOverGui == false)
        {
            // Clone the prefab, and place it where the finger was tapped
            //var position = finger.GetWorldPosition(50.0f);
            //var rotation = Quaternion.identity;
            if (player.arms.isLaserEnable)
            {
                player.PlayerShoot(finger);
                Debug.Log("Finger " + finger.Index + " tapped the screen");
            }

            //var clone    = (GameObject)Instantiate(Prefab, position, rotation);

            // Make sure the prefab gets destroyed after some time
            //Destroy(clone, 2.0f);
        }
    }
Exemplo n.º 10
0
    public void OnFingerSwipe(Lean.LeanFinger finger)
    {
        // Make sure the info text exists
        if (gameObject != null)
        {
            // Store the swipe delta in a temp variable
            var swipe = finger.SwipeDelta;

            Debug.Log(swipe);

            float h = swipe.normalized.x;
            float v = swipe.normalized.y;

            //move direction
            direction = new Vector3(-v, 0f, h).normalized;

            // rotate
            float angle = Mathf.Acos(h / Mathf.Sqrt(h * h + v * v));

            float a = angle / Mathf.PI * 180f;
            if (v > 0f)
            {
                a = -a;
            }
            Rotate(a);
        }
    }
Exemplo n.º 11
0
    public void OnFingerSwipe(Lean.LeanFinger finger)
    {
        // Store the swipe delta in a temp variable
        var swipe = finger.SwipeDelta;

        if (swipe.magnitude > SwipeThreshold)
        {
            if (swipe.x < -Mathf.Abs(swipe.y))
            {
                Debug.Log("You swiped left!");

                RotateLeft();
            }

            if (swipe.x > Mathf.Abs(swipe.y))
            {
                RotateRight();
            }

            if (swipe.y < -Mathf.Abs(swipe.x))
            {
                //_parentX+=SensitivityRotation;
                RotateDown();
            }

            if (swipe.y > Mathf.Abs(swipe.x))
            {
                RotateUp();
            }
        }
    }
Exemplo n.º 12
0
 // Un-lock the finger from currFinger if the finger is released
 void OnFingerUp(LeanFinger finger)
 {
     if (finger == currFinger)
     {
         currFinger = null;
     }
 }
Exemplo n.º 13
0
    public void OnFingerSwipe(Lean.LeanFinger finger)
    {
        // Store the swipe delta in a temp variable
        var swipe = finger.SwipeDelta;

        if (swipe.magnitude > SwipeThreshold)
        {
            if (swipe.x < -Mathf.Abs(swipe.y))
            {
                Debug.Log("You swiped left!");
                //_thisY+=SensitivityRotation;

                newQuaternion = Quaternion.AngleAxis(90, Vector3.up) * transform.rotation;
            }

            if (swipe.x > Mathf.Abs(swipe.y))
            {
                newQuaternion = Quaternion.AngleAxis(-90, Vector3.up) * transform.rotation;
            }

            if (swipe.y < -Mathf.Abs(swipe.x))
            {
                //_parentX+=SensitivityRotation;
                newQuaternion = Quaternion.AngleAxis(90, Vector3.right) * transform.rotation;
            }

            if (swipe.y > Mathf.Abs(swipe.x))
            {
                newQuaternion = Quaternion.AngleAxis(-90, Vector3.right) * transform.rotation;
            }
        }
    }
Exemplo n.º 14
0
    private void OnFingerSet(Lean.LeanFinger finger)
    {
        // Make sure the prefab exists
        if (Prefab != null)
        {
            // Get the name of this finger, and find the line that has the same name
            var fingerName = GetFingerName(finger);
            var line       = lines.Find(l => l.name == fingerName);

            // If the line doesn't exist, create it, give it the same name as the finger, and add it to the lines list
            if (line == null)
            {
                line = Instantiate(Prefab);

                line.name = fingerName;

                lines.Add(line);
            }

            // Copy all snapshot data into this line
            line.SetVertexCount(finger.Snapshots.Count);

            for (var j = 0; j < finger.Snapshots.Count; j++)
            {
                var snapshot = finger.Snapshots[j];

                if (snapshot != null)
                {
                    line.SetPosition(j, snapshot.GetWorldPosition(1.0f));
                }
            }
        }
    }
    //Method while tap or selecting the character
    public void OnFingerTap(Lean.LeanFinger finger)
    {
        // Does the prefab exist?
        // Make sure the finger isn't over any GUI elements
        if (finger.IsOverGui == false)
        {
            var ray = finger.GetRay();
            var hit = default(RaycastHit);

            // Was this finger pressed down on a collider?
            if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
            {
                // The collider is the player1 zarapa boy
                if (hit.collider.gameObject.name == "Player1")
                {
                    charNameText.text = charName + "Zarapa Boy";
                    PlayerPrefs.SetString("gender", "man");
                }
                // The collider is the player2 zarapa girl
                else if (hit.collider.gameObject.name == "Player2")
                {
                    charNameText.text = charName + "Zarapa Girl";
                    PlayerPrefs.SetString("gender", "woman");
                }
            }
        }
    }
Exemplo n.º 16
0
    public void OnFingerSwipe(Lean.LeanFinger finger)
    {
        // Store the swipe delta in a temp variable
        var swipe = finger.SwipeDelta;

        if (swipe.x < -Mathf.Abs(swipe.y))
        {
            Debug.Log("You swiped left!");
        }

        if (swipe.x > Mathf.Abs(swipe.y))
        {
            Debug.Log("You swiped right!");
        }

        if (swipe.y < -Mathf.Abs(swipe.x))
        {
            Debug.Log("You swiped down!");
        }

        if (swipe.y > Mathf.Abs(swipe.x))
        {
            Debug.Log("You swiped up!");
        }
    }
Exemplo n.º 17
0
    public void OnFingerSet(Lean.LeanFinger finger)
    {
        // Is this the current finger?
        if (finger == swipingFinger)
        {
            // The scaled delta position magnitude required to register a swipe
            var swipeThreshold = Lean.LeanTouch.Instance.SwipeThreshold;

            // The amount of seconds we consider valid for a swipe
            var tapThreshold = Lean.LeanTouch.Instance.TapThreshold;

            // Get the scaled delta position between now, and 'swipeThreshold' seconds ago
            var recentDelta = finger.GetScaledSnapshotDelta(tapThreshold);

            // Has the finger recently swiped?
            if (recentDelta.magnitude > swipeThreshold)
            {
                // Get the rigidbody component
                var rigidbody = GetComponent <Rigidbody>();

                // Add force to the rigidbody based on the swipe force
                rigidbody.AddForce(recentDelta.normalized * ImpulseForce, ForceMode.Impulse);

                // Unset the finger so we don't continually add forces to it
                swipingFinger = null;
            }
        }
    }
Exemplo n.º 18
0
    /*protected virtual void LateUpdate()
     * {
     *      // If there is an active finger, move this GameObject based on it
     *      if (draggingFinger != null)
     *      {
     *              Lean.LeanTouch.MoveObject(transform, draggingFinger.DeltaScreenPosition);
     *      }
     * }*/

    public void OnFingerDown(Lean.LeanFinger finger)
    {
        // Raycast information
        var ray = finger.GetRay();
        var hit = default(RaycastHit);

        // Was this finger pressed down on a collider?
        if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
        {
            // Was that collider this one?
            if (hit.collider.gameObject == gameObject)
            {
                // Set the current finger to this one
                draggingFinger = finger;
                if (Collected == false)
                {
                    //play fireworks animation
                    //gameObject.GetComponent<SpinScript>().spinning = true;
                    gameControl.chestsCollected++;
                    Collected = true;
                    gameControl.chestNumbersList.Add(targetNumber);
                    gameControl.saveChests();
                }
            }
        }
    }
Exemplo n.º 19
0
    public void OnFingerSet(Lean.LeanFinger finger)
    {
        // Right side of the screen?
        if (finger.ScreenPosition.x > Screen.width / 2)
        {
            // Does it exist?
            if (RightObject != null)
            {
                // Position it in front of the finger
                RightObject.position = finger.GetWorldPosition(10.0f);
            }
        }
        // Left side?
        else
        {
            // Does it exist?
            if (RightObject != null)
            {
                // Position it in front of the finger
                LeftObject.position = finger.GetWorldPosition(10.0f);
            }
        }

        // NOTE: If you want to prevent fingers from crossing sides then you can check finger.StartScreenPosition first
    }
Exemplo n.º 20
0
    public void OnFingerSwipe(Lean.LeanFinger finger)
    {
        // Get the rigidbody component
        var rigidbody = GetComponent <Rigidbody>();

        // Add force to the rigidbody based on the swipe force
        rigidbody.AddForce(finger.ScaledSwipeDelta * ForceMultiplier);
    }
Exemplo n.º 21
0
 public void OnFingerHeldDown(Lean.LeanFinger finger)
 {
     if (!pinching && !twisting && !dragging && Lean.LeanTouch.Fingers.Count == 1)
     {
         Camera.main.orthographicSize = 5.0f;
         //print ("finger held " + finger.Age);
     }
 }
Exemplo n.º 22
0
 public void OnFingerDown(Lean.LeanFinger finger)
 {
     if (touchBeginEventFunc != null)
     {
         Vector2 screenPosition = finger.ScreenPosition;
         touchBeginEventFunc(finger.ScreenPosition);
     }
 }
Exemplo n.º 23
0
 public void OnFingerUp(Lean.LeanFinger finger)
 {
     // Debug.Log("I HAS A FINGER");
     if (Fingers == finger)
     {
         Fingers = null;
     }
 }
Exemplo n.º 24
0
 public void OnFingerUp(Lean.LeanFinger finger)
 {
     // Was the current finger lifted from the screen?
     if (finger == draggingFinger)
     {
         // Unset the current finger
         draggingFinger = null;
     }
 }
Exemplo n.º 25
0
	public void OnFingerUp(Lean.LeanFinger finger)
	{
		// Was the current finger lifted from the screen?
		if (finger == draggingFinger)
		{
			// Unset the current finger
			draggingFinger = null;
		}
	}
Exemplo n.º 26
0
 public void OnFingerTap(Lean.LeanFinger finger)
 {
     if (finger.IsOverGui == false && GameManager.state == GameManager.PLAYING && Lean.LeanTouch.GuiInUse == false)
     {
         isPressedLeft  = false;
         isPressedRight = false;
         InstantiateBall();
     }
 }
    public void OnFingerSwipe(Lean.LeanFinger finger)
    {
        // Store the swipe delta in a temp variable
        var swipe = finger.SwipeDelta;

        if (swipe.x < -Mathf.Abs(swipe.y))
        {
            swipingUp    = false;
            swipingDown  = false;
            swipingRight = false;
            swipingLeft  = true;
            //InfoText.text = "You swiped left!";
        }
        else
        {
            swipingLeft = false;
        }

        if (swipe.x > Mathf.Abs(swipe.y))
        {
            swipingUp    = false;
            swipingDown  = false;
            swipingRight = true;
            swipingLeft  = false;
            // InfoText.text = "You swiped right!";
        }
        else
        {
            swipingRight = false;
        }

        if (swipe.y < -Mathf.Abs(swipe.x))
        {
            swipingUp    = false;
            swipingDown  = true;
            swipingRight = false;
            swipingLeft  = false;
            //InfoText.text = "You swiped down!";
        }
        else
        {
            swipingDown = false;
        }

        if (swipe.y > Mathf.Abs(swipe.x))
        {
            swipingUp    = true;
            swipingDown  = false;
            swipingRight = false;
            swipingLeft  = false;
            //InfoText.text = "You swiped up!";
        }
        else
        {
            swipingUp = false;
        }
    }
Exemplo n.º 28
0
    IEnumerator GameOver()
    {
        bIsGameOver_     = true;
        pDraggingFinger_ = null;
        CancelInvoke("GenerateBlock");
        HideBlockSelectArea();

        // GameOver 연출 및 추후 pArrTopBlock 초기화에 문제가 없도록 하기 위한 처리
        Block[] pTempArrTopBlock = new Block[GameSetting.BLOCK_COL];
        for (int i = 0; i < GameSetting.BLOCK_COL; ++i)
        {
            if (bArrIsAlertOn_[i])
            {
                HideGameOverAlert(i);
            }

            pTempArrTopBlock[i] = pArrTopBlock_[i];
            while (pTempArrTopBlock[i].pBottom_ != null)
            {
                pTempArrTopBlock[i] = pTempArrTopBlock[i].pBottom_;
            }
        }

        // 코루틴을 이용하여 바닥부터 꼭대기까지 순차적으로 Lock 이 걸리는 연출
        bool bIsEventContinue = true;

        while (bIsEventContinue)
        {
            yield return(new WaitForSeconds(0.2f));

            bIsEventContinue = false;
            SoundManager.pShared.PlaySe(SeType.BlockGameOver);
            for (int i = 0; i < GameSetting.BLOCK_COL; ++i)
            {
                if (pTempArrTopBlock[i] != null)
                {
                    bIsEventContinue = true;
                    pTempArrTopBlock[i].GameOver();
                    RemoveBlockRiseEffect(pTempArrTopBlock[i], true);
                    pTempArrTopBlock[i] = pTempArrTopBlock[i].pTop_;
                }
            }
        }

        for (int i = 0; i < GameSetting.BLOCK_COL; ++i)
        {
            if (pArrFallingBlock_[i] != null)
            {
                pArrFallingBlock_[i].GameOver();
            }
        }

        SoundManager.pShared.PlaySe(SeType.GameOver);
        pCvsForMenu_.gameObject.SetActive(true);

        yield break;
    }
Exemplo n.º 29
0
 public void OnFingerUp(Lean.LeanFinger finger)
 {
     // Was the current finger lifted from the screen?
     if (finger == draggingFinger)
     {
         // Unset the current finger
         mat.color      = defaultColor;
         draggingFinger = null;
     }
 }
Exemplo n.º 30
0
    public void OnFingerDown(Lean.LeanFinger finger)
    {
        // Raycast information
        Ray        ray = finger.GetRay(CameraToUse);
        RaycastHit hit;

        if (MySceneController.GetComponent <SceneController>().LockTarget == false)
        {
            // Was this finger pressed down on a collider?
            if (Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask) == true)
            {
                // Was that collider this one?
                if ((hit.collider.gameObject.transform.parent == gameObject.transform.parent) && (hit.collider.gameObject.layer != 9) && (!Studied))
                {
                    // Set the current finger to this one
                    draggingFinger = finger;

                    _SceneControllerRef._selected          = hit.collider.gameObject.transform.parent.gameObject;
                    _SceneControllerRef.SelectedObjectType = MySceneController.GetComponent <SceneController>()._selected.GetComponent <OrbitalMovement>().MyObjectType.ToString();
                    Capi.set("Globals.SelectedObject", MySceneController.GetComponent <SceneController>()._selected.name);
                    Capi.set("Globals.SelectedObjectType", MySceneController.GetComponent <SceneController>()._selected.GetComponent <OrbitalMovement>().MyObjectType.ToString());

                    CUPCamera.gameObject.GetComponent <CloseUpCamera>().SetMinAndMaxZoom(CloseUpMaxDistance, CloseUpMinDistance, CloseUpStartPercentage);

                    Reticle = GameObject.Find("Reticle ENV");

                    Reticle.GetComponent <ReticleTracker>().FacingIndicator.transform.position = MySceneController.GetComponent <SceneController>()._selected.transform.position;

                    if (Studied)
                    {
                        Reticle.transform.GetChild(0).GetComponent <Image>().sprite = Reticle.GetComponent <ReticleTracker>().BadTargetReticle;
                        //Reticle.GetComponent<Image>().color = Color.red;
                        Reticle.GetComponent <RectTransform>().localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
                    }
                    else
                    {
                        //Debug.Log("CHECK");
                        Reticle.transform.GetChild(0).GetComponent <Image>().sprite = Reticle.GetComponent <ReticleTracker>().OriginalImage;
                        //Reticle.GetComponent<Image>().color = Color.yellow;
                        Reticle.GetComponent <RectTransform>().localEulerAngles = new Vector3(0.0f, 0.0f, 0.0f);
                    }

                    RepositionReticle(MySceneController.GetComponent <SceneController>()._selected);

                    //UpdateOrbitalZoneInfo();

                    CUPCamera.gameObject.GetComponent <CloseUpCamera>().target = MySceneController.GetComponent <SceneController>()._selected.transform;
                    MyFactoidController.CurrentDataset = transform.parent.GetComponent <OrbitalMovement>();
                    MyFactoidController.FixMyFactoids();
                    //_SceneControllerRef.ProbeTargetLabel.text = hit.collider.gameObject.transform.parent.gameObject.name;
                    _SceneControllerRef.TriggerCheckEvent();
                }
            }
        }
    }
    public void OnFingerDown(Lean.LeanFinger finger)
    {
        var ray       = finger.GetRay();          //fires ray with ScreenToWorld at finger pos using LeanTouch
        int layerMask = (1 << 8);                 //ground layer

        CamActive = true;
        if (Physics.Raycast(ray, out hit, 1500, layerMask))
        {
            InitialHit = hit.point;
        }
    }
Exemplo n.º 32
0
    public void OnFingerSwipe(Lean.LeanFinger finger)
    {
        // Make sure the info text exists
        if (gameObject != null)
        {
            Vector3 rbForce = finger.GetDeltaWorldPosition(force, cam);
            //rbForce+=new Vector3(0f,force,0f);

            GetComponent <Rigidbody>().AddForce(rbForce);
        }
    }
Exemplo n.º 33
0
 public void OnFingerUp(Lean.LeanFinger finger)
 {
     if (!CustomCapiNames)
     {
         Capi.set("Camera.SSV.Zoom Level", MyZoomSlider.value);
     }
     else
     {
         Capi.set("Camera." + gameObject.name + ".Zoom Level", MyZoomSlider.value);
     }
 }
Exemplo n.º 34
0
	public void OnFingerDown(Lean.LeanFinger finger)
	{
		// Raycast information
		var ray = finger.GetRay();
		var hit = default(RaycastHit);
		
		// Was this finger pressed down on a collider?
		if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
		{
			// Was that collider this one?
			if (hit.collider.gameObject == gameObject)
			{
				// Set the current finger to this one
				draggingFinger = finger;
			}
		}
	}
Exemplo n.º 35
0
 public void OnFingerDown(Lean.LeanFinger finger)
 {
     draggingFinger = finger;
 }
Exemplo n.º 36
0
	// Only track this if we are zoomed in
	void FingerDown (Lean.LeanFinger obj)
	{

		if (cameraSize != Camera.main.orthographicSize) {

			if (Lean.LeanTouch.Fingers.Count == 1) {
				draggingFinger = obj;
				lastFingerPos = draggingFinger.DeltaScreenPosition;
			}
		}

	}
Exemplo n.º 37
0
	void FingerUp (Lean.LeanFinger obj)
	{
		draggingFinger = null; 
	}
Exemplo n.º 38
0
        // Add a finger based on index, or return the existing one
        private void AddFinger(int index, Vector2 screenPosition)
        {
            var finger = Fingers.Find(t => t.Index == index);

            // No finger found?
            if (finger == null)
            {
                var inactiveIndex = InactiveFingers.FindIndex(t => t.Index == index);

                // Use inactive finger?
                if (inactiveIndex >= 0)
                {
                    finger = InactiveFingers[inactiveIndex]; InactiveFingers.RemoveAt(inactiveIndex);

                    // Inactive for too long?
                    if (finger.Age > TapThreshold)
                    {
                        finger.TapCount = 0;
                    }

                    // Reset values
                    finger.Age         = 0.0f;
                    finger.LastSet     = false;
                    finger.Set         = false;
                    finger.LastHeldSet = false;
                    finger.HeldSet     = false;
                    finger.Tap         = false;
                }
                // Create new finger?
                else
                {
                    finger = new LeanFinger();

                    finger.Index = index;
                }

                finger.StartScreenPosition = screenPosition;
                finger.LastScreenPosition  = screenPosition;
                finger.ScreenPosition      = screenPosition;
                finger.StartedOverGui      = finger.IsOverGui;
                finger.TotalDeltaMagnitude = 0.0f;

                Fingers.Add(finger);
            }

            finger.Set            = true;
            finger.ScreenPosition = screenPosition;

            // Record?
            if (RecordFingers == true)
            {
                // Too many snapshots?
                if (RecordLimit > 0.0f)
                {
                    if (finger.SnapshotDuration > RecordLimit)
                    {
                        var removeCount = finger.GetLowerSnapshotIndex(finger.Age - RecordLimit);

                        finger.ClearSnapshots(removeCount);
                    }
                }

                // Record snapshot?
                if (RecordThreshold > 0.0f)
                {
                    if (finger.Snapshots.Count == 0 || finger.LastSnapshotDelta.magnitude >= RecordThreshold)
                    {
                        finger.RecordSnapshot();
                    }
                }
                else
                {
                    finger.RecordSnapshot();
                }
            }
        }
Exemplo n.º 39
0
 // Lock the current finger down into currFinger
 void OnFingerDown(LeanFinger finger)
 {
     currFinger = finger;
 }