Esempio n. 1
0
    //sends the player to the audio options
    public void Options()
    {
        if (!isPlaying)
        {//checking if an animation is playing before accessing another menu
            isPlaying    = true;
            curMenu      = CurMenu.Options;
            _audio.pitch = 1.2f;
            _audio.PlayOneShot(select, SFXvolume);
            menusAnim.Play("ClosePauseMenus");
            StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenOptions"));

            //Here we are just making sure the enums match their texts/strings
            Text temp;
            if (PlayerPrefs.HasKey("gameSpeed"))
            {
                temp      = GameObject.Find("Canvas/Pause/Menus/OptionMenus/GameSpeedValue").GetComponent <Text>();
                temp.text = PlayerPrefs.GetString("gameSpeed").ToString();
            }
            if (PlayerPrefs.HasKey("difficulty"))
            {
                temp = GameObject.Find("Canvas/Pause/Menus/OptionMenus/DiffText").GetComponent <Text>();
                PauseMenus.difficulty = (PauseMenus.Difficulty)System.Enum.Parse(typeof(PauseMenus.Difficulty), PlayerPrefs.GetString("difficulty"));
                temp.text             = difficulty.ToString();
            }
        }
    }
Esempio n. 2
0
    //sends the player to the audio options
    public void Audio()
    {
        if (!isPlaying)
        {//checking if an animation is playing before accessing another menu
            isPlaying    = true;
            _audio.pitch = 1.2f;
            _audio.PlayOneShot(select, SFXvolume);
            curMenu = CurMenu.Audio;
            //setting all the text to their current values
            Text myText = GameObject.Find("Canvas/Pause/Menus/AudioMenus/BGMValue").GetComponent <Text>();
            myText.text = (BGMvolume * 10).ToString();
            myText      = GameObject.Find("Canvas/Pause/Menus/AudioMenus/SFXValue").GetComponent <Text>();
            myText.text = (SFXvolume * 10).ToString();
            if (PlayerPrefs.HasKey("audioSettings"))
            {
                myText      = GameObject.Find("Canvas/Pause/Menus/AudioMenus/Audio").GetComponent <Text>();
                myText.text = audioSettings.ToString();
            }
            Slider myslider = GameObject.Find("Canvas/Pause/Menus/AudioMenus/SFXVolume/Slider").GetComponent <Slider>();
            myslider.value = (int)(SFXvolume * 10);
            myslider       = GameObject.Find("Canvas/Pause/Menus/AudioMenus/BGMVolume/Slider").GetComponent <Slider>();
            myslider.value = (int)(BGMvolume * 10);

            menusAnim.Play("CloseOptions");
            StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenAudio"));
        }
    }
Esempio n. 3
0
    public void OpenMainMenu()
    {
        activemenu = CurMenu.Main;
        ChangeCurrentActiveMenu(MainMenuGrid);

        backButton.SetActive(false);
    }
Esempio n. 4
0
 public void OpenControlsMenu()
 {
     activemenu = CurMenu.Controls;
     ChangeCurrentActiveMenu(ControlMenu);
     backButton.SetActive(true);
     ControlMenu.GetComponent <ControlsMenu>().Init();
 }
Esempio n. 5
0
 public void OpenOptionsMenu()
 {
     activemenu = CurMenu.Options;
     optionsDefaultButton.SetActive(true);
     backButton.SetActive(true);
     ChangeCurrentActiveMenu(OptionMenu);
 }
Esempio n. 6
0
    public void Return()
    {
        au.pitch = 1f;
        switch (curMenu)
        {
        case CurMenu.Options:
            curMenu = CurMenu.Basic;
            au.PlayOneShot(click, PauseMenus.SFXvolume);
            Animator anim = GameObject.Find("Canvas/Background").GetComponent <Animator>();
            anim.speed = 1;
            anim.Play("FromRed", 0, 0);
            StartCoroutine(FromOptions());
            break;

        case CurMenu.Audio:
            au.PlayOneShot(click, PauseMenus.SFXvolume);
            GetComponent <Animator>().Play("FromAudio", 0, 0);
            curMenu = CurMenu.Options;
            break;

        case CurMenu.Video:
            au.PlayOneShot(click, PauseMenus.SFXvolume);
            GetComponent <Animator>().Play("FromVideo", 0, 0);
            curMenu = CurMenu.Options;
            break;
        }
    }
Esempio n. 7
0
 //sends the player to the Controls
 public void Controls()
 {
     curMenu = CurMenu.Controls;
     menusAnim.Play("CloseOptions");
     StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "Controls"));
     _audio.pitch = 1.2f;
     _audio.PlayOneShot(select, SFXvolume);
 }
Esempio n. 8
0
    //sends the player to the video options
    public void Video()
    {
        if (!isPlaying)
        {//checking if an animation is playing before accessing another menu
            isPlaying    = true;
            _audio.pitch = 1f;
            _audio.PlayOneShot(select, SFXvolume);
            if (PlayerPrefs.HasKey("resolution"))
            {
                PauseMenus.resolution = (PauseMenus.Resolution)System.Enum.Parse(typeof(PauseMenus.Resolution), PlayerPrefs.GetString("resolution"));
            }
            curMenu = CurMenu.Video;
            Text   myText;
            Slider myslider;
            //adjusting the texts/strings to match their current settings
            if (PlayerPrefs.HasKey("brightnessSlider"))
            {
                myslider       = GameObject.Find("Canvas/Pause/Menus/VideoMenus/Brightness/Slider").GetComponent <Slider>();
                myslider.value = PlayerPrefs.GetInt("brightnessSlider");
                myText         = GameObject.Find("Canvas/Pause/Menus/VideoMenus/BrightnessValue").GetComponent <Text>();
                myText.text    = PlayerPrefs.GetInt("brightnessSlider").ToString();
            }
            if (PlayerPrefs.HasKey("quality"))
            {
                PauseMenus.quality = (PauseMenus.Quality)System.Enum.Parse(typeof(PauseMenus.Quality), PlayerPrefs.GetString("quality"));
                myText             = GameObject.Find("Canvas/Pause/Menus/VideoMenus/QualityValue").GetComponent <Text>();
                myText.text        = quality.ToString();
            }
            myText = GameObject.Find("Canvas/Pause/Menus/VideoMenus/ResolutionValue").GetComponent <Text>();
            if (PlayerPrefs.HasKey("resolution"))
            {
                PauseMenus.resolution = (PauseMenus.Resolution)System.Enum.Parse(typeof(PauseMenus.Resolution), PlayerPrefs.GetString("resolution"));
                switch (resolution)
                {
                default:
                    myText.text = "Full Screen";
                    break;

                case Resolution.Small:
                    myText.text = "600x400";
                    break;

                case Resolution.Medium:
                    myText.text = "800x600";
                    break;
                }
            }

            menusAnim.Play("CloseOptions");
            StartCoroutine(WaitTime(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenVideo"));
        }
    }
Esempio n. 9
0
 public void Video()
 {
     if (curMenu == CurMenu.Options)
     {
         au.pitch = 1f;
         GetComponent <Animator>().Play("ToVideo", 0, 0);
         GameObject.Find("Canvas/Menus/Basic/Options/Video").GetComponent <Animator>().enabled   = false;
         GameObject.Find("Canvas/Menus/Basic/Options/Video").GetComponent <Text>().raycastTarget = false;
         curMenu = CurMenu.Video;
         Animator title = GameObject.Find("Canvas/Menus/GameTitle").GetComponent <Animator>();
         title.Play("FlippyFlippy");
     }
 }
Esempio n. 10
0
    //returns the player from the current menu to the previous menu
    public void Return()
    {
        if (!isPlaying)
        {//checking if an animation is playing before accessing another menu
            isPlaying    = true;
            _audio.pitch = 1.2f;
            _audio.PlayOneShot(select, SFXvolume);
            switch (curMenu)
            {
            default:
                break;

            case CurMenu.Options:
                menusAnim.Play("CloseOptions");
                curMenu = CurMenu.Pause;
                StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenPauseMenus"));
                break;

            case CurMenu.Audio:
                menusAnim.Play("CloseAudio");
                curMenu = CurMenu.Options;
                StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenOptions"));
                break;

            case CurMenu.Video:
                PlayerPrefs.SetInt("brightnessSlider", (int)GameObject.Find("Canvas/Pause/Menus/VideoMenus/Brightness/Slider").GetComponent <Slider>().value);
                menusAnim.Play("CloseVideo");
                curMenu = CurMenu.Options;
                StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenOptions"));
                break;

            case CurMenu.Quit:
                menusAnim.Play("CloseQuit");
                curMenu = CurMenu.Pause;
                StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenPauseMenus"));
                break;

            case CurMenu.Controls:
                menusAnim.Play("CloseControls");
                curMenu = CurMenu.Options;
                StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenOptions"));
                break;

            case CurMenu.Reset:
                goto case CurMenu.Quit;
            }
        }
        SaveLoadPrefs.Save();
    }
Esempio n. 11
0
 public void Audio()
 {
     if (curMenu == CurMenu.Options)
     {
         au.pitch = 1f;
         GetComponent <Animator>().Play("ToAudio", 0, 0);
         GameObject.Find("Canvas/Menus/Basic/Options/Audio").GetComponent <Animator>().enabled   = false;
         GameObject.Find("Canvas/Menus/Basic/Options/Audio").GetComponent <Text>().raycastTarget = false;
         curMenu = CurMenu.Audio;
         Animator title = GameObject.Find("Canvas/Menus/GameTitle").GetComponent <Animator>();
         title.Play("FlippyFlippy");
         GameObject.Find("Canvas/Menus/Basic/Options/Audio/Settings").GetComponent <Text>().text   = PauseMenus.audioSettings.ToString();
         GameObject.Find("Canvas/Menus/Basic/Options/Audio").GetComponent <Transform>().localScale = new Vector3(1, 1, 1);
     }
 }
Esempio n. 12
0
    void Start()
    {
        curMenu = CurMenu.Pause;
        //just to avoid any null references for the static variable, we're going to find the audio source
        _audio = gameObject.GetComponent <AudioSource>();
        AudioSource music = GameObject.Find("AudioManager/Music").GetComponent <AudioSource>();

        MusicScript.auSource = music;

        //setting defaults
        difficulty = Difficulty.Normal;
        gameSpeed  = GameSpeed.Slow;
        resolution = Resolution.Fullscreen;
        scaleTime  = 1f;
        SFXvolume  = .8f;
        //loading all player prefs
        SaveLoadPrefs.Load();
    }
Esempio n. 13
0
 //double checks with player before they quit (or reset the level)
 //if the bool, quit (in the parameters), is set to true, it returns to menu, else if it is false it will reset the level
 public void Quit(bool quit)
 {
     if (!isPlaying)
     {//checking if an animation is playing before accessing another menu
         isPlaying    = true;
         _audio.pitch = 1.2f;
         _audio.PlayOneShot(select, SFXvolume);
         if (quit)//returns to main menu
         {
             curMenu = CurMenu.Quit;
         }
         else //resets the level
         {
             curMenu = CurMenu.Reset;
         }
         menusAnim.Play("ClosePauseMenus");
         StartCoroutine(MyCoroutine(menusAnim.GetCurrentAnimatorStateInfo(0).length, "OpenQuit"));
     }
 }
Esempio n. 14
0
    public void Options()
    {
        au.pitch = 1f;
        au.PlayOneShot(click, PauseMenus.SFXvolume);
        GameObject myObject = GameObject.Find("Canvas/Menus/Basic/Options");

        myObject.GetComponent <Animator>().enabled   = false;
        myObject.GetComponent <Text>().raycastTarget = false;
        myObject = GameObject.Find("Canvas/Menus/Basic/Leaderboards");
        myObject.GetComponent <Text>().raycastTarget = false;
        myObject = GameObject.Find("Canvas/Menus/Basic/Credits");
        myObject.GetComponent <Text>().raycastTarget = false;
        curMenu = CurMenu.Options;
        GetComponent <Animator>().Play("ToOptions", 0, 0);
        Animator title = GameObject.Find("Canvas/Menus/GameTitle").GetComponent <Animator>();

        title.Play("FlippyFlippy");
        Animator anim = GameObject.Find("Canvas/Background").GetComponent <Animator>();

        anim.speed = 1;
        anim.Play("ToRed", 0, 0);
        BasicMenusScript.canSelect = false;
    }
Esempio n. 15
0
 public void OpenCreditMenu()
 {
     activemenu = CurMenu.Credit;
 }
Esempio n. 16
0
 public void OpenSoundMenu()
 {
     activemenu = CurMenu.Sound;
 }