UICamera.ProcessTouches C# (CSharp) Méthode

ProcessTouches() public méthode

Update touch-based events.
public ProcessTouches ( ) : void
Résultat void
	public void ProcessTouches ()
	{
		for (int i = 0; i < Input.touchCount; ++i)
		{
			Touch input = Input.GetTouch(i);

			currentTouchID = allowMultiTouch ? input.fingerId : 1;
			currentTouch = GetTouch(currentTouchID);

			bool pressed = (input.phase == TouchPhase.Began) || currentTouch.touchBegan;
			bool unpressed = (input.phase == TouchPhase.Canceled) || (input.phase == TouchPhase.Ended);
			currentTouch.touchBegan = false;

			if (pressed)
			{
				currentTouch.delta = Vector2.zero;
			}
			else
			{
				// Although input.deltaPosition can be used, calculating it manually is safer (just in case)
				currentTouch.delta = input.position - currentTouch.pos;
			}

			currentTouch.pos = input.position;
			hoveredObject = Raycast(currentTouch.pos, ref lastHit) ? lastHit.collider.gameObject : fallThrough;
			if (hoveredObject == null) hoveredObject = genericEventHandler;
			currentTouch.current = hoveredObject;
			lastTouchPosition = currentTouch.pos;

			// We don't want to update the last camera while there is a touch happening
			if (pressed) currentTouch.pressedCam = currentCamera;
			else if (currentTouch.pressed != null) currentCamera = currentTouch.pressedCam;

			// Double-tap support
			if (input.tapCount > 1) currentTouch.clickTime = Time.realtimeSinceStartup;

			// Process the events from this touch
			ProcessTouch(pressed, unpressed);

			// If the touch has ended, remove it from the list
			if (unpressed) RemoveTouch(currentTouchID);
			currentTouch = null;

			// Don't consider other touches
			if (!allowMultiTouch) break;
		}
	}

Usage Example

    static int ProcessTouches(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        UICamera obj = (UICamera)LuaScriptMgr.GetUnityObjectSelf(L, 1, "UICamera");

        obj.ProcessTouches();
        return(0);
    }
All Usage Examples Of UICamera::ProcessTouches