first, whining never helps, it won’t get you pity or sympathy. You’re asking for help from people who have no reason to help you and do not stand to benefit in any way from doing so; you’re entitled to nothing. Remember that.
That said, I’ll attempt to help anyway this time, despite your attitude, because I do understand your frustration.
This is basically a variation of the standard mouse dragging vs clicking problem, and the same solution ought to work. What you need is some state information.
in Idle state:
check for a two-finger touch. If you get one, remember the finger positions and calculate and store the distance between them, and change state to TwoFingerTouch.
in TwoFingerTouch state:
If one or both touches have ended: compare their final positions to their originals. If they’ve both moved in the same general direction, and moved far enough to qualify as a swipe, … do a swipe, and go back to the Idle state. If they moved different directions, or not far enough, go back to Idle state.
If both touches are still there, calc the current distance between them. If it’s reduced enough, transition to PinchZoom state.
in PinchZoom state:
Calculate the new distance between the fingers, and apply zoom level based on this relative to original distance between them.
If one or both fingers released, return to Idle state.
state machine
As for how to implement this simple state machine, there are many ways, a search for State Machines will probably find you many examples. Here’s one very simple way it could be done:
enum TouchState {
Idle,
TwoFingerTouch,
PinchZoom,
};
var currentState:TouchState=Idle;
function Update()
{
/*any pre-processing of input common to all states here */
switch(idle)
{
case TouchState.Idle:
/*Idle state code here*/
break;
case TouchState.TwoFingerTouch:
/*Two finger touch state code here*/
break;
case TouchState.PinchZoom:
/*PinchZoom state here*/
break;
}
}