private void Update() { UpdateTouches(); if (NewTouches.Any()) { State.OnNewInput(); } else { State.OnUpdate(); } }
/// <summary> /// Updates tracked touches and stores the rest /// </summary> private void UpdateTouches() { NewTouches.Clear(); foreach (var touch in Input.touches) { if (ActiveTouches.ContainsKey(touch.fingerId)) { CheckTouchFlags(touch); ActiveTouches[touch.fingerId] = touch; } else { ActiveTouches[touch.fingerId] = touch; ActiveTouchFlags[touch.fingerId] = new TouchFlags(); ActiveTouchOrigins[touch.fingerId] = touch.position; NewTouches.Add(touch); } } }