/////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Change selection.
    /// </summary>
    public void ChangeSelectionWheel()
    {
        if (GameManager.Instance.SelectionWheel.activeInHierarchy)
        {
            float _RawAngle;
            float globalOffset = 0;
            _RawAngle = Mathf.Atan2(_Gamepad.GetStick_L().Y, _Gamepad.GetStick_L().X) * Mathf.Rad2Deg;

            if (_Gamepad.GetStick_L().X != 0 || _Gamepad.GetStick_L().Y != 0)
            {
                _CurrentAngle = NormalizeAngle(-_RawAngle + 90 - globalOffset + (_AngleOffset / 2f));
                GameManager.Instance.SelectionWheel.GetComponentInChildren <SelectionWheel>().
                SelectionMarker.rotation = Quaternion.Euler(0, 0, _RawAngle + 270);
            }

            if (_AngleOffset != 0)
            {
                _RadialIndex = (int)(_CurrentAngle / _AngleOffset);
            }

            for (int i = 0; i < _SelectionWheel._WheelButtons.Count; ++i)
            {
                if (_RadialIndex == i)
                {
                    StartCoroutine(DelayedSelect(_SelectionWheel._WheelButtons[i]));
                }
            }
        }
    }
Example #2
0
    void GetActiveInputDevice()
    {
        if (CurrentController == "Keyboard")
        {
            if (_Gamepad.IsConnected)
            {
                if (_Gamepad.GetAnyButton() || _Gamepad.GetStick_L().X != 0)
                {
                    CurrentController = "Controller";
                    _MousePosition    = Input.mousePosition;

                    if (Navigator.SettingsMenu.WholeAreaObject.activeInHierarchy)
                    {
                        StartCoroutine(DelayedSelectButton(Navigator.SettingsMenu.StartButton));
                    }
                    else
                    if (ReferenceButton != null)
                    {
                        StartCoroutine(DelayedSelectButton(ReferenceButton));
                    }
                }
            }
        }
        else if (CurrentController == "Controller")
        {
            if (Input.GetMouseButton(0) || Input.GetKey(KeyCode.Escape) || Input.GetKey(KeyCode.Return) || _MousePosition != Input.mousePosition)
            {
                CurrentController = "Keyboard";
            }
        }
    }
Example #3
0
 void GetActiveInputDevice()
 {
     if (CurrentController == "Keyboard")
     {
         if (_Gamepad.IsConnected)
         {
             if (_Gamepad.GetAnyButton() || _Gamepad.GetStick_L().X != 0)
             {
                 CurrentController = "Controller";
             }
         }
     }
     else if (CurrentController == "Controller")
     {
         if (Input.GetMouseButton(0) || Input.GetKey(KeyCode.Escape) || Input.GetKey(KeyCode.Return))
         {
             CurrentController = "Keyboard";
         }
     }
 }