예제 #1
0
 private void GestureControllerOnReleased(SwipeInput obj)
 {
     if (!_currentCarClicked)
     {
         return;
     }
     _currentCarClicked.SetCarMoving(false);
     _currentCarClicked = null;
     _isMovingCar       = false;
 }
예제 #2
0
        private void GestureControllerOnPressed(SwipeInput obj)
        {
            _lastSwipeInput = obj;

            Ray ray = mainCam.ScreenPointToRay(obj.EndPosition);

            if (!Physics.Raycast(ray, out RaycastHit hit, 500f))
            {
                return;
            }
            if (hit.collider.GetComponent <Car.Car>())
            {
                _isMovingCar = true;
                Car.Car hitCar = hit.collider.GetComponent <Car.Car>();
                _currentCarClicked = hitCar;
                Vector3 point = hit.point;
                point.y = 0;
                _currentCarClicked.SetTargetPosition(point + touchOffset);
                _currentCarClicked.SetCarMoving(true);
            }
        }