Beispiel #1
0
        public static void Hover(CommandMoveTargetManipulator target, MovementPart part)
        {
            if (currentMoving == null)
            {
                return;
            }

            if (target != currentHovering && currentHovering != null)
            {
                currentHovering.ReleaseHovering();
            }

            currentPart     = part;
            currentHovering = target;
            currentHovering.SetHovering(part);
        }
Beispiel #2
0
        public void SetHovering(MovementPart part)
        {
            switch (part)
            {
            case MovementPart.Top:
                OnHoverTop?.Invoke();
                break;

            case MovementPart.Bottom:
                OnHoverBottom?.Invoke();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(part), part, null);
            }
        }
Beispiel #3
0
    protected override void Dragging()
    {
        Vector3 mouseWorldPoint = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Vector2 catapultToMouse = mouseWorldPoint - MovementPart.position;

        if (catapultToMouse.sqrMagnitude > _maxStretchSqr)
        {
            _rayToMouse.direction = catapultToMouse;
            mouseWorldPoint       = _rayToMouse.GetPoint(maxStretch);
        }
        mouseWorldPoint.z         = 0f;
        Slider.transform.position = mouseWorldPoint;
        var angle = MovementPart.rotation.eulerAngles.z;

        MovementPart.LookAt(Slider.transform, Vector3.forward);

        // Хуйня но я заебался уже
        if (!(MovementPart.localRotation.eulerAngles.z > 360 - maxAngle || MovementPart.localRotation.eulerAngles.z < maxAngle))
        {
            MovementPart.localRotation = Quaternion.Euler(new Vector3(0, 0, 360 - maxAngle));
        }
    }