Esempio n. 1
0
 public static void Init()
 {
     for (int i = 0; i < MaxTouchCount; i++)
     {
         m_touches[i] = new Ssg.Touch();
     }
 }
Esempio n. 2
0
    private void OnPointerDown(PointerEventData eventData)
    {
        m_touches.RemoveAll((t) => { return(t.Id == eventData.pointerId); });
        var touch = new Ssg.Touch();

        touch.Id       = eventData.pointerId;
        touch.Position = eventData.position;
        m_touches.Add(touch);
    }
    private float CalculatePinchDelta(Ssg.Touch touch0, Ssg.Touch touch1)
    {
        var t0OldPos    = touch0.Position - touch0.Delta;
        var t1OldPos    = touch1.Position - touch1.Delta;
        var oldDistance = (t0OldPos - t1OldPos).magnitude;
        var newDistance = (touch0.Position - touch1.Position).magnitude;

        if (oldDistance == 0)
        {
            return(1.0f);
        }

        return(newDistance / oldDistance);
    }