Example #1
0
        private RelativePoint CreateRelativePointFromWorldPoint(Vector2 world_point)
        {
            if (world_press_target != null)
            {
                return(world_press_target.gameObject.transform
                       .CreateRelativePointFromWorldPoint(world_point));
            }

            return(RelativePoint.FromPoint(world_point));
        }
Example #2
0
        private void UpdatePositionInitial()
        {
            initial_press_position = current_press_position;

            world_press_target =
                Physics2DExtensions.OverlapCircleAll(initial_press_position, world_press_system.GetPressRadius(), world_press_system.GetTargetLayers())
                .Narrow(c => c.HasComponentUpward <IWorldPressTarget>())
                .Convert(c => c.gameObject)
                .FindRolling(
                    new RollingCriteria <GameObject>(RollingCriteriaTarget.Larger, g => g.GetSortingLayer().IfNotNull(l => l.GetValue())),
                    new RollingCriteria <GameObject>(RollingCriteriaTarget.Smaller, g => g.GetPlanarSize().GetMinComponent())
                    )
                .IfNotNull(z => z.GetComponentUpward <IWorldPressTarget>());

            touch_point = CreateRelativePointFromWorldPoint(GetCurrentPressPosition());
            world_press_target.IfNotNull(t => t.Touch(this));

            timer.Restart();
        }
Example #3
0
        private void UpdatePositionSubsequent()
        {
            if (world_press_target != null)
            {
                if (is_dragging)
                {
                    world_press_target.Drag(this);
                }
                else
                {
                    if (current_press_position.IsOutsideDistance(touch_point.GetWorldPoint(), world_press_system.GetDragThreshold()))
                    {
                        world_press_target.Grab(this);

                        drag_point  = CreateRelativePointFromWorldPoint(GetCurrentPressPosition());
                        is_dragging = true;
                    }
                }
            }
        }
Example #4
0
 static public RelativePoint CreateRelativePointFromWorldPoint(this Transform item, Vector3 world_point)
 {
     return(RelativePoint.FromWorldPoint(item, world_point));
 }
Example #5
0
 static public RelativePoint CreateRelativePointFromLocalPoint(this Transform item, Vector3 local_point)
 {
     return(RelativePoint.FromLocalPoint(item, local_point));
 }