예제 #1
0
    IEnumerator ShowAnim()
    {
        audioManager.SetVolumeMusic(0.3f, true);
        yield return(new WaitForSeconds(1f));

        for (int i = 0; i < panels.Count; i++)
        {
            if (i < ScoreManager.FinalScore(index))
            {
                if (ScoreManager.IsWinner(index))
                {
                    if (i < 2)
                    {
                        audioManager.PlayAlert(MotherFuckingAudioManager.AlertList.POINT_LVL1);
                    }
                    if (i >= 2 && i <= 4)
                    {
                        audioManager.PlayAlert(MotherFuckingAudioManager.AlertList.POINT_LVL2);
                    }
                    if (i > 4)
                    {
                        audioManager.PlayAlert(MotherFuckingAudioManager.AlertList.POINT_LVL3);
                    }
                }
                panels[i].SetActive(true);
            }
            else
            {
                break;
            }
            yield return(new WaitForSeconds(0.5f));
        }
        yield return(new WaitForSeconds(0.5f));

        winnerIcon.gameObject.SetActive(ScoreManager.IsWinner(index));
        yield return(null);

        RaycastHit hit;

        if (Physics.Raycast(Camera.main.ScreenPointToRay(winnerIcon.transform.position), out hit))
        {
            goldHammer.transform.position = hit.point;
        }
        if (ScoreManager.IsWinner(index))
        {
            audioManager.PlayAlert(MotherFuckingAudioManager.AlertList.GOLD_HAMMER);
            goldHammer.SetActive(true);
        }
        yield return(new WaitForSeconds(2.0f));

        audioManager.SetVolumeMusic(0.4f, true);
    }
    private void Update()
    {
        if (!gamePanel.activeSelf && !settingsPanel.activeSelf && !creditPanel.activeSelf && menuActif)
        {
            timer -= Time.deltaTime;
            if (Input.GetAxisRaw("Vertical") > 0 && index > 0 && timer <= 0)
            {
                timer      = (firstTimer) ? 0.5f : 0.1f;
                firstTimer = false;
                index--;
                UpdateCursors();
            }
            else if (Input.GetAxisRaw("Vertical") < 0 && index < menuCursors.Length - 1 && timer <= 0)
            {
                timer      = (firstTimer) ? 0.5f : 0.1f;
                firstTimer = false;
                index++;
                UpdateCursors();
            }
            else if (Input.GetButtonDown("Attack"))
            {
                StartCoroutine(ActivatedMenu());
            }
            else if (Input.GetAxisRaw("Vertical") == 0)
            {
                timer      = 0;
                firstTimer = true;
            }
        }
        else if (creditPanel.gameObject.activeSelf)
        {
            if (Input.GetButtonDown("Cancel"))
            {
                audioManager.PlayAlert(MotherFuckingAudioManager.AlertList.BTN_VALIDATION);
                creditPanel.gameObject.SetActive(false);
            }
        }
        else if (settingsPanel.gameObject.activeSelf)
        {
            timer -= Time.deltaTime;
            if (Input.GetAxisRaw("Vertical") > 0 && settingsIndex > 0 && timer <= 0)
            {
                timer      = (firstTimer) ? 0.5f : 0.1f;
                firstTimer = false;
                settingsIndex--;
                UpdateSettingsCursors();
            }
            else if (Input.GetAxisRaw("Vertical") < 0 && settingsIndex < 4 && timer <= 0)
            {
                timer      = (firstTimer) ? 0.5f : 0.1f;
                firstTimer = false;
                settingsIndex++;
                UpdateSettingsCursors();
            }
            else if (Input.GetButtonDown("Cancel"))
            {
                audioManager.PlayAlert(MotherFuckingAudioManager.AlertList.BTN_VALIDATION);
                settingsPanel.gameObject.SetActive(false);
            }
            else
            {
                if (Input.GetAxisRaw("Vertical") == 0)
                {
                    timer      = 0;
                    firstTimer = true;
                }
                switch (settingsIndex)
                {
                case 0:
                    TryChangeSliderValue(numberTurnSlider, 0.1f);
                    break;

                case 1:
                    TryChangeSliderValue(timerSlider, 0.1f);
                    break;

                case 2:
                    TryChangeSliderValue(audioSliders[0], 0.01f);
                    break;

                case 3:
                    TryChangeSliderValue(audioSliders[1], 0.01f);
                    break;

                case 4:
                    TryChangeSliderValue(audioSliders[2], 0.01f);
                    break;
                }
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButtonDown("L") && GameManager.selectedMap > 0)
        {
            GameManager.selectedMap--;
            UpdateMapSelector();
        }
        if (Input.GetButtonDown("R") && GameManager.selectedMap < mapSelectors.Length - 1)
        {
            GameManager.selectedMap++;
            UpdateMapSelector();
        }


        for (int i = 0; i <= 4; i++)
        {
            if (Input.GetButtonDown("Attack " + i))
            {
                bool have = false;
                for (int j = 0; j < 4; j++)
                {
                    if (GameManager.playerOrder[j] == i)
                    {
                        have = true;
                        break;
                    }
                }
                if (have)
                {
                    break;
                }
                for (int j = 0; j < 4; j++)
                {
                    if (GameManager.playerOrder[j] == -1)
                    {
                        GameManager.playerOrder[j] = i;
                        playerOn[j].SetActive(true);
                        playerOff[j].SetActive(false);
                        break;
                    }
                }
            }
            else if (Input.GetButtonDown("Cancel " + i))
            {
                bool ok = false;
                for (int j = 0; j < 4; j++)
                {
                    if (GameManager.playerOrder[j] == i)
                    {
                        GameManager.playerOrder[j] = -1;
                        ok = true;
                        playerOn[j].SetActive(false);
                        playerOff[j].SetActive(true);
                    }
                }
                if (!ok)
                {
                    audioManager.PlayAlert(MotherFuckingAudioManager.AlertList.BTN_VALIDATION);
                    gameObject.SetActive(false);
                }
            }
        }

        int counter = 0;

        for (int j = 0; j < 4; j++)
        {
            if (GameManager.playerOrder[j] != -1)
            {
                counter++;
            }
        }
        notEnoughtPlayer.SetActive(counter < 2);
        pressStartToPlay.SetActive(counter > 1);

        if (Input.GetButtonDown("Start"))
        {
            menuManager.Play();
        }
    }
 public void HammerAlert()
 {
     audioManager.PlayAlert(MotherFuckingAudioManager.AlertList.BTN_VALIDATION);
 }