コード例 #1
0
ファイル: InputController.cs プロジェクト: Runnetty1/Astero
 private void OnEnable()
 {
     ShipControll.OnShipWarpEvent += PlayerWarping;
     WindowsActive = false;
     OnInputStateChangeEvent?.Invoke(false);
     OnWindowVisibilityEvent?.Invoke("all", false);
 }
コード例 #2
0
ファイル: InputController.cs プロジェクト: Runnetty1/Astero
        // Update is called once per frame
        void Update()
        {
            //CLIENT ONLY

            if (!NoInputs && !WindowsActive)
            {
                if (player != null)
                {
                    DetectInput();
                }
                CheckForMouse1ClickEvents();
                if (Input.GetAxis("Mouse ScrollWheel") > 0f) // forward
                {
                    OnScrollEvent?.Invoke(ScrollDirection.DOWN);
                }
                else if (Input.GetAxis("Mouse ScrollWheel") < 0f) // backwards
                {
                    OnScrollEvent?.Invoke(ScrollDirection.UP);
                }
            }

            if (!WindowsActive && Input.GetKeyDown(KeyCode.Tab))
            {
                WindowsActive = true;
                OnInputStateChangeEvent?.Invoke(true);
                //OnWindowVisibilityEvent?.Invoke("all",true);
            }
            if (!WindowsActive && Input.GetKeyDown(KeyCode.I))
            {
                WindowsActive = true;
                OnInputStateChangeEvent?.Invoke(true);
                OnWindowVisibilityEvent?.Invoke("ShipInfoWindow", true);
            }
            if (!ActiveWindow && Input.GetKeyDown(KeyCode.R))
            {
                ActiveWindow = true;

                OnWindowVisibilityEvent?.Invoke("RadarList", true);
            }
            else if (ActiveWindow && Input.GetKeyDown(KeyCode.R))
            {
                ActiveWindow = false;

                OnWindowVisibilityEvent?.Invoke("RadarList", false);
            }

            if (WindowsActive && Input.GetKeyDown(KeyCode.Tab))
            {
                WindowsActive = false;
                OnInputStateChangeEvent?.Invoke(false);
                OnWindowVisibilityEvent?.Invoke("all", false);
            }
        }