using CW.Common; using PaintCore; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; namespace game { [RequireComponent(typeof(CwHitPointers))] public class BrushPointerTouch : CwPointer { /// If you want the paint to appear above the finger, then you can set this number to something positive. public Vector2 Offset { set { offset = value; } get { return offset; } } [SerializeField] private Vector2 offset = Vector2.zero; protected virtual void Update() { CwInputManager.Finger finger; bool isFollowing = false; Vector2 screenPosition = Vector2.zero; for (var i = 0; i < CwInput.GetTouchCount(); i++) { int index; Vector2 position; float pressure; bool set; if (EventSystem.current == null) return; if (EventSystem.current.IsPointerOverGameObject()) return; CwInput.GetTouch(i, out index, out position, out pressure, out set); position += offset * CwInputManager.ScaleFactor; var down = GetFinger(index, position, pressure, set, out finger); cachedHitPointers.HandleFingerUpdate(finger, down, set == false); screenPosition = position; isFollowing = true; if (set == false) { TryNullFinger(index); } } if (isFollowing) FishingYachtAct.Publish(new EventWashingGestureFollowPositionData(screenPosition, true)); else FishingYachtAct.Publish(new EventWashingGestureFollowPositionData(screenPosition, false)); } } }