Exemple #1
0
    // applies horizontal axis rounded to a positive or negative of the move distance
    void MoveHorizontal(float xInput)
    {
        if (cursorHidden == false && cursorCoroutine == null)
        {
            cursorCoroutine = StartCoroutine(CursorDelayRoutine());

            // saves starting position, moves
            Vector3 startingPosition = transform.position;
            Vector3 translation      = new Vector3((xInput > 0 ? 1 : -1) * cursorSearchDistance, 0, 0);
            transform.Translate(translation);

            // calls raycast search to read an object the cursor is over
            bool foundItem = RaycastSearch(startingPosition);

            // if no item was found (meaning it moved horizontally off the item screen, moves it to the top slot in the far row and activates UI graphic
            if (foundItem == false)
            {
                // activates the r and z icons and sets the main cursor to inactive
                if (xInput > 0)
                {
                    menuUIControl.ActivateRIcon();
                }
                else if (xInput < 0)
                {
                    menuUIControl.ActivateZIcon();
                }

                // hides cursor
                moveAudio.Play();
                SendName?.Invoke("");
                HideCursor();
                CursorHidden?.Invoke();
            }
        }
    }
Exemple #2
0
 // sets cursor bool and gameobject to inactive
 void HideCursor()
 {
     SendName?.Invoke("");
     cursorHidden = true;
     CursorHidden?.Invoke();
     mainCursorImage.enabled = false;
 }