public override void OnPointerDown(PointerEventData eventData) { if (Velocity.magnitude == 0) { MovementStart?.Invoke(this, EventArgs.Empty); } _curPosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y); _underInertia = false; Dragging = true; _time = 0.0f; Velocity = Vector2.zero; _finishing = false; }
public void PointerEndMove(Vector3 pointerPos) { AudioCtrl.PlaySound(GameAudioEventType.END_MOVE); if (activeRow != -1) { int fcCount = 0; List <int> numbersSteps; float angle = 0; float angleNotClamped = 0; int aN = getCursorPos(pointerPos, out endMovePos, out angle, out angleNotClamped); int s2 = endMovePos - startMovePos; string sd = SaveController.GetSaveDataAsJson(field, currentScore, lastNumber); GameLogic.MoveEnd(fieldVis, field, activeRow, -s2); GameLogic.ShiftMap(fieldVis, field, Direction.Up, Max, Min, activeRow, out fcCount, out numbersSteps, ref lastNumber); if (numbersSteps.Count > 0) { SaveController.AddStep(sd); } ScoreCount(fcCount, numbersSteps); shifting = 0; bool hasMoves = GameLogic.CheckMoves(field, Max, Min); MovementStart?.Invoke(false); if (!hasMoves) { Lost(); } if (SaveController.HasSteps) { BackButton.Switch(true); } } }