void Update() { if (false == active) { return; } Touch touch = new Touch(); if (false == GetTouch(this.touchFinger, ref touch) || TouchPhase.Ended == touch.phase || TouchPhase.Canceled == touch.phase ) { this.active = false; OnReleativeCoordX.Invoke(0); OnReleativeCoordY.Invoke(0); OnDeltaCoordX.Invoke(0); OnDeltaCoordY.Invoke(0); return; } var offset = touch.deltaPosition * sensScale; var releative = (touch.position - this.startPosition) * sensScale * Sensetive; OnReleativeCoordX.Invoke(releative.x); OnReleativeCoordY.Invoke(YInvert ? -releative.y : releative.y); OnDeltaCoordX.Invoke(offset.x); OnDeltaCoordY.Invoke(YInvert ? -offset.y : offset.y); }
public void DotFlow() { Random rnd = new Random(); for (int i = 0; i < 10; i++) { x = rnd.NextDouble() * 20 - 10; y = rnd.NextDouble() * 20 - 10; if (x < 0 && y < 0) { OnCoordChanged?.Invoke(this); // запуск события } } }
public void DotFlow() { Random rnd = new Random(); for (int i = 0; i < 10; i++) { this.X = rnd.Next(-10, 11) + rnd.NextDouble(); this.Y = rnd.Next(-10, 11) + rnd.NextDouble(); if (X < 0 & Y < 0) { OnCoordChanged?.Invoke(this); } } }