Ejemplo n.º 1
0
    /// <summary>
    /// 左入力があったとき
    /// </summary>
    /// <returns>移動した(true)してない(false)</returns>
    protected bool Push_LeftBiutton()
    {
        if (Input.GetKeyDown(KeyCode.LeftArrow) || XCI.GetDPadDown(XboxDPad.Left, controllerNumber) || (LeftStickInput.x < -0.9f && LeftStickflag == false))
        {
            //次のターゲット番号に変更
            NowNumberColumn--;

            //ターゲットが配列をオーバーしたら
            if (NowNumberColumn < 0)
            {
                NowNumberColumn = NumberColumns - 1;
            }

            //移動方法
            if (TManager_cs.Mode_Data == TitleManager.SELECTMODE.PLAYERNUM || TManager_cs.Mode_Data == TitleManager.SELECTMODE.STAGESELECT)
            {
                this.Move_RectTransform();
            }
            else
            {
                this.Move_Transform();
            }

            return(true);
        }

        return(false);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 下入力があったとき
    /// </summary>
    /// <returns>移動した(true)してない(false)</returns>
    protected bool Push_DownButton()
    {
        if (Input.GetKeyDown(KeyCode.DownArrow) || XCI.GetDPadDown(XboxDPad.Down, controllerNumber) || (LeftStickInput.y < -0.9f && LeftStickflag == false))
        {
            //行数を一つ進める
            NowNumberLine++;

            //カーソルが行数を超えようとしたら
            if (NowNumberLine > NumberLine - 1)
            {
                NowNumberLine = 0;
            }

            //移動方法
            if (TManager_cs.Mode_Data == TitleManager.SELECTMODE.PLAYERNUM || TManager_cs.Mode_Data == TitleManager.SELECTMODE.STAGESELECT)
            {
                this.Move_RectTransform();
            }
            else
            {
                this.Move_Transform();
            }

            return(true);
        }

        return(false);
    }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        Transform myTransform = this.transform;
        Vector3   pos         = myTransform.position;

        // Controllerの左スティックのAxisを取得
        Vector2 input = new Vector2(XCI.GetAxis(XboxAxis.LeftStickX, ControlerNamber), XCI.GetAxis(XboxAxis.LeftStickY, ControlerNamber));

        Debug.Log(pos);

        if (camera.transform.position.x >= -17.9 && camera.transform.position.x <= -17.7)
        {
            cursor = true;
        }

        if (input.y == 0 && input.x == 0)
        {
            //スティックが倒れてなければtrue
            move = true;
        }
        if (cursor == true)
        {
            if (move == true)
            {
                //下を押したときの処理
                if (Input.GetKeyDown(KeyCode.DownArrow) || XCI.GetDPadDown(XboxDPad.Down, ControlerNamber) || input.y < -0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        sound01.PlayOneShot(sound01.clip);
                        FaceNum++;
                    }
                    //一番下で押したとき上に戻る
                    if (pos.y <= -3)
                    {
                        pos.y    = 2.4f;
                        FaceNum -= 4;
                    }
                    //下に移動
                    else
                    {
                        pos.y -= 1.86f;
                    }
                    move = false;
                }
                //上を押したときの処理
                if (Input.GetKeyDown(KeyCode.UpArrow) || XCI.GetDPadDown(XboxDPad.Up, ControlerNamber) || input.y > 0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        sound01.PlayOneShot(sound01.clip);
                        FaceNum--;
                    }
                    //一番上で押したとき下に移動
                    if (pos.y >= 2.3)
                    {
                        pos.y    = -3.2f;
                        FaceNum += 4;
                    }
                    //上に移動
                    else
                    {
                        pos.y += 1.86f;
                    }
                    move = false;
                }
                //右を押したときの処理
                if (Input.GetKeyDown(KeyCode.RightArrow) || XCI.GetDPadDown(XboxDPad.Right, ControlerNamber) || input.x > 0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        sound01.PlayOneShot(sound01.clip);
                        FaceNum += 4;
                    }
                    //右側で押したとき左へ移動
                    if (pos.x >= -15)
                    {
                        pos.x    = -23.7f;
                        FaceNum -= 8;
                    }
                    //右に移動
                    else
                    {
                        pos.x += 4.2f;
                    }
                    move = false;
                }
                //左を押したときの処理
                if (Input.GetKeyDown(KeyCode.LeftArrow) || XCI.GetDPadDown(XboxDPad.Left, ControlerNamber) || input.x < -0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        sound01.PlayOneShot(sound01.clip);
                        FaceNum -= 4;
                    }
                    //左で押したとき右に移動
                    if (pos.x <= -23.3)
                    {
                        pos.x    = -11.1f;
                        FaceNum += 12;
                    }
                    //左に移動
                    else
                    {
                        pos.x -= 4.2f;
                    }
                    move = false;
                }
            }
            //決定処理
            if (Input.GetKeyDown(KeyCode.Space) || XCI.GetButtonDown(XboxButton.B, ControlerNamber))
            {
                FaceCount();
                cursor = false;
            }
            myTransform.position = pos;  // 座標を設定
        }
    }
Ejemplo n.º 4
0
    // Update is called once per frame
    void Update()
    {
        Transform myTransform = this.transform;
        Vector3   pos         = myTransform.position;

        // Controllerの左スティックのAxisを取得
        Vector2 input = new Vector2(XCI.GetAxis(XboxAxis.LeftStickX, ControlerNamber), XCI.GetAxis(XboxAxis.LeftStickY, ControlerNamber));

        //ステージセレクトになった時カーソルを動かせるように
        if (camera.transform.position.x <= 17.9 && camera.transform.position.x >= 17.7)
        {
            cursor = true;
        }

        if (input.y == 0 && input.x == 0)
        {
            //スティックが倒れてなければtrue
            move = true;
        }

        if (cursor == true)
        {
            if (move == true)
            {
                //下を押したときの処理
                if (Input.GetKeyDown(KeyCode.DownArrow) || XCI.GetDPadDown(XboxDPad.Down, ControlerNamber) || input.y < -0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        sound01.PlayOneShot(sound01.clip);
                        StageNum++;
                    }
                    //一番下で押したとき上に戻る
                    if (pos.y <= -3.3f)
                    {
                        pos.y     = 2.2f;
                        StageNum -= 4;
                    }
                    //下に移動
                    else
                    {
                        pos.y -= 1.9f;
                    }
                    move = false;
                }
                //上を押したときの処理
                if (Input.GetKeyDown(KeyCode.UpArrow) || XCI.GetDPadDown(XboxDPad.Up, ControlerNamber) || input.y > 0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        sound01.PlayOneShot(sound01.clip);
                        StageNum--;
                    }
                    //一番上で押したとき下に移動
                    if (pos.y >= 2.0f)
                    {
                        pos.y     = -3.5f;
                        StageNum += 4;
                    }
                    //上に移動
                    else
                    {
                        pos.y += 1.9f;
                    }
                    move = false;
                }
                //右を押したときの処理
                if (Input.GetKeyDown(KeyCode.RightArrow) || XCI.GetDPadDown(XboxDPad.Right, ControlerNamber) || input.x > 0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        sound01.PlayOneShot(sound01.clip);
                        StageNum += 4;
                    }
                    //右側で押したとき左へ移動
                    if (pos.x >= 20)
                    {
                        pos.x     = 12;
                        StageNum -= 8;
                    }
                    //右に移動
                    else
                    {
                        pos.x = 20;
                    }
                    move = false;
                }
                //左を押したときの処理
                if (Input.GetKeyDown(KeyCode.LeftArrow) || XCI.GetDPadDown(XboxDPad.Left, ControlerNamber) || input.x < -0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        sound01.PlayOneShot(sound01.clip);
                        StageNum -= 4;
                    }
                    //左で押したとき右に移動
                    if (pos.x <= 12)
                    {
                        pos.x     = 20;
                        StageNum += 8;
                    }
                    //左に移動
                    else
                    {
                        pos.x = 12;
                    }
                    move = false;
                }
            }
            //決定処理
            if (Input.GetKeyDown(KeyCode.Space) || XCI.GetButtonDown(XboxButton.B, ControlerNamber))
            {
                if (StageNum == 8)
                {
                    NumCount();
                }
                NumCount();
                StartCoroutine("coRoutine");
                Debug.Log("最終値" + StageNum);
            }
            myTransform.position = pos;  // 座標を設定

            //キャラセレクトに戻る処理
            if (Input.GetKeyDown(KeyCode.Backspace) || XCI.GetButtonDown(XboxButton.A, ControlerNamber))
            {
                sound01.PlayOneShot(sound03.clip);
                camera.transform.position = new Vector3(-17.8f, 0, 0);  //キャラセレクトに戻る
                cursor = false;
            }
        }
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        if (!isReady)
        {
            if (XCI.GetDPadDown(XboxDPad.Left, PlayerNumber))
            {
                images[currentSelection].SetActive(false);
                currentSelection--;
                if (currentSelection == -1)
                {
                    currentSelection = images.Length - 1;
                }
                images[currentSelection].SetActive(true);
                //Determine what avatar the player is using
                if (PlayerNumber == 1)
                {
                    PlayerPrefs.SetInt("Player1Avatar", currentSelection);
                }
                else if (PlayerNumber == 2)
                {
                    PlayerPrefs.SetInt("Player2Avatar", currentSelection);
                }
                else if (PlayerNumber == 3)
                {
                    PlayerPrefs.SetInt("Player3Avatar", currentSelection);
                }
                else if (PlayerNumber == 4)
                {
                    PlayerPrefs.SetInt("Player4Avatar", currentSelection);
                }
            }
            if (XCI.GetDPadDown(XboxDPad.Right, PlayerNumber))
            {
                images[currentSelection].SetActive(false);
                currentSelection++;
                if (currentSelection == images.Length)
                {
                    currentSelection = 0;
                }
                images[currentSelection].SetActive(true);
            }
            if (XCI.GetButtonDown(XboxButton.A, PlayerNumber))
            {
                isReady = true;
                isReadyText.SetActive(true);
            }

            //DEBUG CONTROLS
            if (PlayerNumber == 1)
            {
                if (Input.GetButtonDown("Player1Fire"))
                {
                    isReady = true;
                    isReadyText.SetActive(true);
                    PlayerPrefs.SetInt("Player1Avatar", currentSelection);
                }
                if (Input.GetButtonDown("Player1Left"))
                {
                    images[currentSelection].SetActive(false);
                    currentSelection--;
                    if (currentSelection == -1)
                    {
                        currentSelection = images.Length - 1;
                    }
                    images[currentSelection].SetActive(true);
                }
                if (Input.GetButtonDown("Player1Right"))
                {
                    images[currentSelection].SetActive(false);
                    currentSelection++;
                    if (currentSelection == images.Length)
                    {
                        currentSelection = 0;
                    }
                    images[currentSelection].SetActive(true);
                }
            }
            if (PlayerNumber == 2)
            {
                if (Input.GetButtonDown("Player2Fire"))
                {
                    isReady = true;
                    isReadyText.SetActive(true);
                    PlayerPrefs.SetInt("Player2Avatar", currentSelection);
                }
                if (Input.GetButtonDown("Player2Left"))
                {
                    images[currentSelection].SetActive(false);
                    currentSelection--;
                    if (currentSelection == -1)
                    {
                        currentSelection = images.Length - 1;
                    }
                    images[currentSelection].SetActive(true);
                }
                if (Input.GetButtonDown("Player2Right"))
                {
                    images[currentSelection].SetActive(false);
                    currentSelection++;
                    if (currentSelection == images.Length)
                    {
                        currentSelection = 0;
                    }
                    images[currentSelection].SetActive(true);
                }
            }
            if (PlayerNumber == 3)
            {
                if (Input.GetButtonDown("Player3Fire"))
                {
                    isReady = true;
                    isReadyText.SetActive(true);
                    PlayerPrefs.SetInt("Player3Avatar", currentSelection);
                }
                if (Input.GetButtonDown("Player3Left"))
                {
                    images[currentSelection].SetActive(false);
                    currentSelection--;
                    if (currentSelection == -1)
                    {
                        currentSelection = images.Length - 1;
                    }
                    images[currentSelection].SetActive(true);
                }
                if (Input.GetButtonDown("Player3Right"))
                {
                    images[currentSelection].SetActive(false);
                    currentSelection++;
                    if (currentSelection == images.Length)
                    {
                        currentSelection = 0;
                    }
                    images[currentSelection].SetActive(true);
                }
            }
            if (PlayerNumber == 4)
            {
                if (Input.GetButtonDown("Player4Fire"))
                {
                    isReady = true;
                    isReadyText.SetActive(true);
                    PlayerPrefs.SetInt("Player4Avatar", currentSelection);
                }
                if (Input.GetButtonDown("Player4Left"))
                {
                    images[currentSelection].SetActive(false);
                    currentSelection--;
                    if (currentSelection == -1)
                    {
                        currentSelection = images.Length - 1;
                    }
                    images[currentSelection].SetActive(true);
                }
                if (Input.GetButtonDown("Player4Right"))
                {
                    images[currentSelection].SetActive(false);
                    currentSelection++;
                    if (currentSelection == images.Length)
                    {
                        currentSelection = 0;
                    }
                    images[currentSelection].SetActive(true);
                }
            }
        }
        //Is ready don't change image
        else
        {
            if (XCI.GetButtonDown(XboxButton.A, PlayerNumber))
            {
                isReady = false;
                isReadyText.SetActive(false);
            }
            //DEBUG CONTROLS
            if (PlayerNumber == 1)
            {
                if (Input.GetButtonDown("Player1Fire"))
                {
                    isReady = false;
                    isReadyText.SetActive(false);
                }
            }
            if (PlayerNumber == 2)
            {
                if (Input.GetButtonDown("Player2Fire"))
                {
                    isReady = false;
                    isReadyText.SetActive(false);
                }
            }
            if (PlayerNumber == 3)
            {
                if (Input.GetButtonDown("Player3Fire"))
                {
                    isReady = false;
                    isReadyText.SetActive(false);
                }
            }
            if (PlayerNumber == 4)
            {
                if (Input.GetButtonDown("Player4Fire"))
                {
                    isReady = false;
                    isReadyText.SetActive(false);
                }
            }
        }
    }
 public override bool GetButtonCurrentDownState()
 {
     // As XboxJoystickDPad is an exact copy of XboxDPad
     // in this implementation, I can just cast the enum.
     return(XCI.GetDPadDown((XboxDPad)this.button));
 }
Ejemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        Transform myTransform = this.transform;
        Vector3   pos         = myTransform.position;

        // Controllerの左スティックのAxisを取得
        Vector2 input = new Vector2(XCI.GetAxis(XboxAxis.LeftStickX, ControlerNamber), XCI.GetAxis(XboxAxis.LeftStickY, ControlerNamber));

        if (camera.transform.position.x == 0)
        {
            cursor = true;
        }

        if (input.y == 0)
        {
            //スティックを倒してなかったらtrueに
            move = true;
        }

        if (cursor == true)
        {
            if (move == true)
            {
                //下を押したときの処理
                if (Input.GetKeyDown(KeyCode.DownArrow) || XCI.GetDPadDown(XboxDPad.Down, ControlerNamber) || input.y < -0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        sound01.PlayOneShot(sound01.clip);
                        //プレイヤーの合計人数
                        PlayerNum++;
                        //4の時に下を押したら1に戻る
                        if (PlayerNum > PLAYERMAX)
                        {
                            PlayerNum = 1;
                        }
                    }
                    //4の時に下を押したら1に戻る
                    if (pos.y <= -3.3f)
                    {
                        pos.y = 2.2f;
                    }
                    //カーソル移動
                    else
                    {
                        pos.y -= 1.9f;
                    }

                    Debug.Log("+して" + PlayerNum);
                    move = false;
                }
                //上を押したときの処理
                if (Input.GetKeyDown(KeyCode.UpArrow) || XCI.GetDPadDown(XboxDPad.Up, ControlerNamber) || input.y > 0.9f)
                {
                    if (sound01.isPlaying == false)
                    {
                        //プレイヤーの合計人数
                        PlayerNum--;
                        //1の時に上を押したら4に行く
                        if (PlayerNum < 1)
                        {
                            PlayerNum = PLAYERMAX;
                        }
                        sound01.PlayOneShot(sound01.clip);
                    }
                    //1の時に上上を押したら4に行く
                    if (pos.y >= 2.0f)
                    {
                        pos.y = -3.5f;
                    }
                    //カーソルを上に移動
                    else
                    {
                        pos.y += 1.9f;
                    }
                    Debug.Log("-して" + PlayerNum);
                    move = false;
                }
            }
            myTransform.position = pos;  // 座標を設定
            //プレイ人数を決定
            if (Input.GetKeyDown(KeyCode.Space) || XCI.GetButtonDown(XboxButton.B, ControlerNamber))
            {
                TitleManager TManager_cs = TManager.GetComponent <TitleManager>();

                //TManager_cs.PlayerNam_Data = PlayerNum;
                sound01.PlayOneShot(sound02.clip);
                camera.transform.position = new Vector3(-17.8f, 0, 0);  //人数セレクトに移動
                Debug.Log("最終値" + PlayerNum);
                cursor = false;
            }
        }
    }
Ejemplo n.º 8
0
    void Update()
    {
        transform.position = Vector3.MoveTowards(transform.position, buttonPositions[currentIndex].transform.position, 15);


        if (XCI.GetDPadDown(XboxDPad.Up, allContollers))
        {
            //shift down
            if (currentIndex > 0)
            {
                currentIndex--;
            }
        }


        if (XCI.GetDPadDown(XboxDPad.Down, allContollers))
        {
            //shift up
            if (currentIndex < buttonPositions.Count - 1)
            {
                currentIndex++;
            }
        }

        if (XCI.GetButtonDown(XboxButton.A, allContollers))
        {
            buttonPositions[currentIndex].GetComponent <Button>().onClick.Invoke();

            //reset all button Positons


            if (currentScene.buildIndex == 1)
            {
                gameObject.SetActive(false);
            }
            else
            {
                buttonPositions.Clear();
            }



            /*
             * for every menu panel
             * if the menu panel is active in scene
             * for every child of that menu panel that has children
             * add all children to the buttonPositions list
             *
             */

            for (int outerIndex = 0; outerIndex < menuButtonCollection.Length; outerIndex++)
            {
                if (menuButtonCollection[outerIndex].activeInHierarchy)
                {
                    for (int innerIndex = 0; innerIndex < menuButtonCollection[outerIndex].transform.GetChild(1).childCount; innerIndex++)
                    {
                        buttonPositions.Add(menuButtonCollection[outerIndex].transform.GetChild(1).GetChild(innerIndex).gameObject);
                    }
                }
            }



            currentIndex = 0;
        }



        //keyBoard Code
        if (Input.GetKeyDown(KeyCode.W))
        {
            //shift down
            if (currentIndex > 0)
            {
                currentIndex--;
            }
        }
        if (Input.GetKeyDown(KeyCode.S))
        {
            //shift up
            if (currentIndex < buttonPositions.Count - 1)
            {
                currentIndex++;
            }
        }
    }
Ejemplo n.º 9
0
    void WeaponSwitching()
    {
        ///////////////////////////////////////////////////////// WEAPON SWITCHING //////////////////////////////////////////////
        int prevSelectedWeapon = _currentlySelectedWeapon;

        // DPAD input
        if (XCI.GetDPadDown(XboxDPad.Right, _inputScript.controller))
        {
            //switch to weapon slot 0
            prevSelectedWeapon = 0; //set new selected weapon slot enum
            switchDirection    = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Right;
            if (_gunInventory[prevSelectedWeapon].gunObject != null)
            {
                playerWorldSpaceUIScr.StartWeaponSwitchWorldSpaceUI(switchDirection);
            }
        }

        if (XCI.GetDPadDown(XboxDPad.Left, _inputScript.controller))
        {
            prevSelectedWeapon = 1;
            switchDirection    = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Left;
            if (_gunInventory[prevSelectedWeapon].gunObject != null)
            {
                playerWorldSpaceUIScr.StartWeaponSwitchWorldSpaceUI(switchDirection);
            }
        }

        if (XCI.GetDPadDown(XboxDPad.Up, _inputScript.controller))
        {
            prevSelectedWeapon = 2; //set new selected weapon slot enum
            switchDirection    = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Up;
            if (_gunInventory[prevSelectedWeapon].gunObject != null)
            {
                playerWorldSpaceUIScr.StartWeaponSwitchWorldSpaceUI(switchDirection);
            }
        }

        float leftTrigHeight = MAX_TRG_SCL * (1.0f - XCI.GetAxis(XboxAxis.LeftTrigger, _inputScript.controller));


        if (leftTrigHeight < 1.0f && !bLeftTriggerDown)
        {
            bLeftTriggerDown      = true;
            grenadePreviousWeapon = prevSelectedWeapon;

            prevSelectedWeapon = 3; //set new selected weapon slot enum
            switchDirection    = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Down;
            if (_gunInventory[prevSelectedWeapon].gunObject != null)
            {
                playerWorldSpaceUIScr.StartWeaponSwitchWorldSpaceUI(switchDirection);
                _gunInventory[prevSelectedWeapon].gunObject.GetComponent <SCR_GrenadeParent>().GrenadePossible();
            }
        }

        if (leftTrigHeight >= 1.0f && bLeftTriggerDown)
        {
            bLeftTriggerDown   = false;
            prevSelectedWeapon = grenadePreviousWeapon;
            switch (prevSelectedWeapon)
            {
            case 0: switchDirection = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Right; break;

            case 1: switchDirection = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Left; break;

            case 2: switchDirection = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Up; break;
            }

            if (_gunInventory[prevSelectedWeapon].gunObject != null)
            {
                playerWorldSpaceUIScr.StartWeaponSwitchWorldSpaceUI(switchDirection);
                _gunInventory[prevSelectedWeapon].gunObject.GetComponent <SCR_AutomaticWeapon>().SetBulletTimer(0.5f);
            }
        }

        if (XCI.GetButtonUp(XboxButton.Y, _inputScript.controller))
        {
            //loop through inventory until next gunobject is found
            prevSelectedWeapon = CycleWeapons(prevSelectedWeapon);

            //set worldspace UI elements of new gun object
            switch (prevSelectedWeapon)
            {
            case 0:
                switchDirection = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Right;
                break;

            case 1:
                switchDirection = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Left;
                break;

            case 2:
                switchDirection = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Up;
                break;

            case 3:
                switchDirection = SCR_PlayerWorldSpaceUI.WeaponSwitchDirection.Down;
                break;
            }

            if (_gunInventory[prevSelectedWeapon].gunObject != null)
            {
                playerWorldSpaceUIScr.StartWeaponSwitchWorldSpaceUI(switchDirection);
            }
        }

        if (prevSelectedWeapon != _currentlySelectedWeapon)
        {
            if (_gunInventory[prevSelectedWeapon].gunObject != null)
            {
                StopReloadCoroutines();
                uiManagerScript.ResetGaugePin(gameObject.tag);
                if (_gunInventory[_currentlySelectedWeapon].gunObject != null)
                {
                    ResetReloadValues();
                    _gunInventory[_currentlySelectedWeapon].gunObject.SetActive(false);
                }

                // remove reload prompt if they switch weapon to a weapon with ammo
                if (GetAmmo(_currentlySelectedWeapon) > 0)
                {
                    if (playerWorldSpaceUIScr.bIsDisplayed)
                    {
                        playerWorldSpaceUIScr.ShowReloadPrompt(false);
                    }
                }
                else
                {
                    if (!playerWorldSpaceUIScr.bIsDisplayed)
                    {
                        playerWorldSpaceUIScr.ShowReloadPrompt(true);
                    }
                }

                if (!bHasSwitchedWeapons && bTutorialCanSwitchWeapons)
                {
                    GameObject tutorialManager = GameObject.FindGameObjectWithTag("TutorialManager");
                    if (tutorialManager)
                    {
                        SCR_TutorialManager tutorialManagerScr = tutorialManager.GetComponent <SCR_TutorialManager>();
                        tutorialManagerScr.SetHasSwitchedWeapons();
                    }
                    bHasSwitchedWeapons = true;
                }

                if (prevSelectedWeapon != 3)
                {
                    _grenadeSelected                 = false;
                    _currentlySelectedWeapon         = prevSelectedWeapon;
                    _attackScript.setGrenadeSelected = _grenadeSelected;
                    _attackScript.setGrenadeSCR      = null;
                    _currentWeaponInterface          = (IWeapon)_gunInventory[prevSelectedWeapon].gunObject.GetComponent(typeof(IWeapon));
                    _gunInventory[prevSelectedWeapon].gunObject.SetActive(true);
                    _attackScript.UpdateWeaponInterface(_currentWeaponInterface);
                    if (_currentlySelectedWeapon != 2)
                    {
                        float percentage = _currentWeaponInterface.ReturnClipSize() * playerStats.GetUpgradeLevelMultiplier(PlayerUpgradeType.reload);
                        uiManagerScript.SetGauge(gameObject.tag, (int)percentage);
                        float clipPercentage = _currentWeaponInterface.ClipPercentagerFilled();
                        uiManagerScript.SetCurrentAmmoText(gameObject.tag, clipPercentage * _currentWeaponInterface.ReturnClipSize(), _gunInventory[prevSelectedWeapon].currentAmmo, _currentWeaponInterface.ReturnClipSize());
                        uiManagerScript.SwitchGunImages(gameObject.tag, false, ThrowableType.FireGrenade, false, _currentWeaponInterface.RetrieveGunValues().ReturnGunValues().GUNTYPE, _currentWeaponInterface.RetrieveGunValues().ReturnGunValues().RARITY, _currentWeaponInterface.RetrieveGunValues().ReturnGunValues().EFFECT);
                    }
                    else
                    {
                        uiManagerScript.SetGauge(gameObject.tag, 0);
                        float clipPercentage = _currentWeaponInterface.ClipPercentagerFilled();
                        uiManagerScript.SetCurrentAmmoText(gameObject.tag, clipPercentage * _currentWeaponInterface.ReturnClipSize(), _gunInventory[prevSelectedWeapon].currentAmmo, _currentWeaponInterface.ReturnClipSize(), true);
                        uiManagerScript.SwitchGunImages(gameObject.tag, false, ThrowableType.FireGrenade, true);
                    }


                    PlaySwitchingSound();
                }
                else
                {
                    _currentWeaponInterface  = null;
                    _currentlySelectedWeapon = prevSelectedWeapon;
                    _grenadeSelected         = true;
                    SCR_GrenadeParent currentGrenadeScript = _gunInventory[_currentlySelectedWeapon].gunObject.GetComponent <SCR_GrenadeParent>();
                    _attackScript.setGrenadeSCR            = currentGrenadeScript;
                    currentGrenadeScript.bHasResetVelocity = false;
                    _attackScript.setGrenadeSelected       = _grenadeSelected;
                    _gunInventory[_currentlySelectedWeapon].gunObject.SetActive(true);



                    if (_gunInventory[_currentlySelectedWeapon].currentAmmo > 0)
                    {
                        currentGrenadeScript.setCurrentAmmo(_gunInventory[_currentlySelectedWeapon].currentAmmo);
                        //_gunInventory[_currentlySelectedWeapon].currentAmmo = 0;
                    }
                    uiManagerScript.SetCurrentAmmoText(gameObject.tag, _gunInventory[_currentlySelectedWeapon].currentAmmo, 0, 0);
                    uiManagerScript.SetGauge(gameObject.tag, 0);

                    if (currentGrenadeScript)
                    {
                        uiManagerScript.SwitchGunImages(gameObject.tag, true, currentGrenadeScript.GetGrenadeType());
                    }

                    weaponSwitchingSource.PlayOneShot(grenadeSwitchingClip);
                }

                uiManagerScript.SwitchSelectedWeaponUI(gameObject.tag, prevSelectedWeapon);

                //playerWorldSpaceUIScr.StartWeaponSwitchWorldSpaceUI(switchDirection);
            }
            else
            {
                weaponSwitchingSource.PlayOneShot(failedWeaponSwitchClip);
            }
        }
    }