Exemple #1
0
    float GetDesiredSelectionPosition(PauseMenuSelection selection)
    {
        switch (selection)
        {
        case PauseMenuSelection.ReturnToGame:
            m_ReturnToGame.DesiredAlpha   = 255.0f / 255.0f;
            m_Restart.DesiredAlpha        = 100.0f / 255.0f;
            m_BackToMainMenu.DesiredAlpha = 50.0f / 255.0f;
            m_ReturnToGame.FadeSpeed      = 0.2f;
            m_Restart.FadeSpeed           = 0.2f;
            m_BackToMainMenu.FadeSpeed    = 0.2f;
            return(0.0f);

        case PauseMenuSelection.Restart:
            m_ReturnToGame.DesiredAlpha   = 100.0f / 255.0f;
            m_Restart.DesiredAlpha        = 255.0f / 255.0f;
            m_BackToMainMenu.DesiredAlpha = 100.0f / 255.0f;
            m_ReturnToGame.FadeSpeed      = 0.2f;
            m_Restart.FadeSpeed           = 0.2f;
            m_BackToMainMenu.FadeSpeed    = 0.2f;
            return(30.0f);

        case PauseMenuSelection.BackToMainMenu:
            m_ReturnToGame.DesiredAlpha   = 50.0f / 255.0f;
            m_Restart.DesiredAlpha        = 100.0f / 255.0f;
            m_BackToMainMenu.DesiredAlpha = 255.0f / 255.0f;
            m_ReturnToGame.FadeSpeed      = 0.2f;
            m_Restart.FadeSpeed           = 0.2f;
            m_BackToMainMenu.FadeSpeed    = 0.2f;
            return(60.0f);
        }
        return(0.0f);
    }
Exemple #2
0
    void RecieveInput()
    {
        var deadZone = 0.1f;

        if (Input.GetAxis("Vertical") > deadZone)
        {
            var status = m_CurrentMenuStatus;
            status--;
            if (status < PauseMenuSelection.ReturnToGame)
            {
                status = PauseMenuSelection.ReturnToGame;
            }
            m_DesiredStatus = status;
        }
        else if (Input.GetAxis("Vertical") < -deadZone)
        {
            var status = m_CurrentMenuStatus;
            status++;
            if (status > PauseMenuSelection.BackToMainMenu)
            {
                status = PauseMenuSelection.BackToMainMenu;
            }
            m_DesiredStatus = status;
        }
        if (Input.GetButtonDown("Confirm"))
        {
            switch (m_DesiredStatus)
            {
            case PauseMenuSelection.ReturnToGame:
                this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToGame;
                break;

            case PauseMenuSelection.Restart:
                m_DesiredStageName     = Application.loadedLevelName;
                this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToOther;
                break;

            case PauseMenuSelection.BackToMainMenu:
                m_DesiredStageName     = "MainMenu_Level";
                this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToOther;
                break;

            default:
                return;
            }
        }
        else if (Input.GetButtonDown("Back") ||
                 Input.GetButtonDown("Start") ||
                 Input.GetKeyDown(KeyCode.Escape))
        {
            this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToGame;
        }
    }
Exemple #3
0
    void SmoothToSelection(float desiredSelection)
    {
        float tempY = m_MenuSelector.transform.position.y;

        tempY = Mathf.Lerp(tempY, desiredSelection, 0.2f);
        if (Mathf.Abs(tempY - desiredSelection) <= 1.0f)
        {
            m_CurrentMenuStatus = m_DesiredStatus;
        }
        m_MenuSelector.transform.position = new Vector3(m_MenuSelector.transform.position.x,
                                                        tempY,
                                                        m_MenuSelector.transform.position.z);
    }
    void Start()
    {
        m_PauseMenuStatus = PauseMenuStatus.Selecting;
        m_MenuSelector = GameObject.Find("Menu") as GameObject;

        if (GameObject.Find("Resume").GetComponent<M_MenuSelection>() != null)
            m_ReturnToGame = GameObject.Find("Resume").GetComponent<M_MenuSelection>() as M_MenuSelection;
        else
            m_ReturnToGame = GameObject.Find("Resume").AddComponent<M_MenuSelection>() as M_MenuSelection;

        if (GameObject.Find("Restart").GetComponent<M_MenuSelection>() != null)
            m_Restart = GameObject.Find("Restart").GetComponent<M_MenuSelection>() as M_MenuSelection;
        else
            m_Restart = GameObject.Find("Restart").AddComponent<M_MenuSelection>() as M_MenuSelection;

        if (GameObject.Find("ExitGame").GetComponent<M_MenuSelection>() != null)
            m_BackToMainMenu = GameObject.Find("ExitGame").GetComponent<M_MenuSelection>() as M_MenuSelection;
        else
            m_BackToMainMenu = GameObject.Find("ExitGame").AddComponent<M_MenuSelection>() as M_MenuSelection;

        if (GameObject.Find("SelectLineL").GetComponent<M_MenuSelection>() != null)
            m_SelectLineLeft = GameObject.Find("SelectLineL").GetComponent<M_MenuSelection>() as M_MenuSelection;
        else
            m_SelectLineLeft = GameObject.Find("SelectLineL").AddComponent<M_MenuSelection>() as M_MenuSelection;

        if (GameObject.Find("SelectLineR").GetComponent<M_MenuSelection>() != null)
            m_SelectLineRight = GameObject.Find("SelectLineR").GetComponent<M_MenuSelection>() as M_MenuSelection;
        else
            m_SelectLineRight = GameObject.Find("SelectLineR").AddComponent<M_MenuSelection>() as M_MenuSelection;

        if (GameObject.Find("SelectPaint").GetComponent<M_MenuSelection>() != null)
            m_SelectPaint = GameObject.Find("SelectPaint").GetComponent<M_MenuSelection>() as M_MenuSelection;
        else
            m_SelectPaint = GameObject.Find("SelectPaint").AddComponent<M_MenuSelection>() as M_MenuSelection;

        m_DesiredStatus     = PauseMenuSelection.ReturnToGame;
        m_CurrentMenuStatus = PauseMenuSelection.ReturnToGame;

        m_FadePlane = GameObject.Find("FadePlane").GetComponent<Renderer>().material;

        m_DesiredStageName = Application.loadedLevelName;
    }
 void SmoothToSelection(float desiredSelection)
 {
     float tempY = m_MenuSelector.transform.position.y;
     tempY = Mathf.Lerp(tempY, desiredSelection, 0.2f);
     if (Mathf.Abs(tempY - desiredSelection) <= 1.0f)
     {
         m_CurrentMenuStatus = m_DesiredStatus;
     }
     m_MenuSelector.transform.position = new Vector3(m_MenuSelector.transform.position.x,
                                                     tempY,
                                                     m_MenuSelector.transform.position.z);
 }
 void RecieveInput()
 {
     var deadZone = 0.1f;
     if (Input.GetAxis("Vertical") > deadZone)
     {
         var status = m_CurrentMenuStatus;
         status--;
         if (status < PauseMenuSelection.ReturnToGame)
         {
             status = PauseMenuSelection.ReturnToGame;
         }
         m_DesiredStatus = status;
     }
     else if (Input.GetAxis("Vertical") < -deadZone)
     {
         var status = m_CurrentMenuStatus;
         status++;
         if (status > PauseMenuSelection.BackToMainMenu)
         {
             status = PauseMenuSelection.BackToMainMenu;
         }
         m_DesiredStatus = status;
     }
     if (Input.GetButtonDown("Confirm"))
     {
         switch (m_DesiredStatus)
         {
             case PauseMenuSelection.ReturnToGame:
                 this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToGame;
                 break;
             case PauseMenuSelection.Restart:
                 m_DesiredStageName = Application.loadedLevelName;
                 this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToOther;
                 break;
             case PauseMenuSelection.BackToMainMenu:
                 m_DesiredStageName = "MainMenu_Level";
                 this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToOther;
                 break;
             default:
                 return;
         }
     }
     else if (Input.GetButtonDown("Back") ||
              Input.GetButtonDown("Start") ||
              Input.GetKeyDown(KeyCode.Escape))
     {
         this.m_PauseMenuStatus = PauseMenuStatus.FadeOutToGame;
     }
 }
 float GetDesiredSelectionPosition(PauseMenuSelection selection)
 {
     switch (selection)
     {
         case PauseMenuSelection.ReturnToGame:
             m_ReturnToGame.DesiredAlpha     = 255.0f / 255.0f;
             m_Restart.DesiredAlpha          = 100.0f / 255.0f;
             m_BackToMainMenu.DesiredAlpha   = 50.0f / 255.0f;
             m_ReturnToGame.FadeSpeed        = 0.2f;
             m_Restart.FadeSpeed             = 0.2f;
             m_BackToMainMenu.FadeSpeed      = 0.2f;
             return 0.0f;
         case PauseMenuSelection.Restart:
             m_ReturnToGame.DesiredAlpha     = 100.0f / 255.0f;
             m_Restart.DesiredAlpha          = 255.0f / 255.0f;
             m_BackToMainMenu.DesiredAlpha   = 100.0f / 255.0f;
             m_ReturnToGame.FadeSpeed        = 0.2f;
             m_Restart.FadeSpeed             = 0.2f;
             m_BackToMainMenu.FadeSpeed      = 0.2f;
             return 30.0f;
         case PauseMenuSelection.BackToMainMenu:
             m_ReturnToGame.DesiredAlpha     = 50.0f / 255.0f;
             m_Restart.DesiredAlpha          = 100.0f / 255.0f;
             m_BackToMainMenu.DesiredAlpha   = 255.0f / 255.0f;
             m_ReturnToGame.FadeSpeed        = 0.2f;
             m_Restart.FadeSpeed             = 0.2f;
             m_BackToMainMenu.FadeSpeed      = 0.2f;
             return 60.0f;
     }
     return 0.0f;
 }
Exemple #8
0
    void Start()
    {
        m_PauseMenuStatus = PauseMenuStatus.Selecting;
        m_MenuSelector    = GameObject.Find("Menu") as GameObject;

        if (GameObject.Find("Resume").GetComponent <M_MenuSelection>() != null)
        {
            m_ReturnToGame = GameObject.Find("Resume").GetComponent <M_MenuSelection>() as M_MenuSelection;
        }
        else
        {
            m_ReturnToGame = GameObject.Find("Resume").AddComponent <M_MenuSelection>() as M_MenuSelection;
        }

        if (GameObject.Find("Restart").GetComponent <M_MenuSelection>() != null)
        {
            m_Restart = GameObject.Find("Restart").GetComponent <M_MenuSelection>() as M_MenuSelection;
        }
        else
        {
            m_Restart = GameObject.Find("Restart").AddComponent <M_MenuSelection>() as M_MenuSelection;
        }

        if (GameObject.Find("ExitGame").GetComponent <M_MenuSelection>() != null)
        {
            m_BackToMainMenu = GameObject.Find("ExitGame").GetComponent <M_MenuSelection>() as M_MenuSelection;
        }
        else
        {
            m_BackToMainMenu = GameObject.Find("ExitGame").AddComponent <M_MenuSelection>() as M_MenuSelection;
        }

        if (GameObject.Find("SelectLineL").GetComponent <M_MenuSelection>() != null)
        {
            m_SelectLineLeft = GameObject.Find("SelectLineL").GetComponent <M_MenuSelection>() as M_MenuSelection;
        }
        else
        {
            m_SelectLineLeft = GameObject.Find("SelectLineL").AddComponent <M_MenuSelection>() as M_MenuSelection;
        }

        if (GameObject.Find("SelectLineR").GetComponent <M_MenuSelection>() != null)
        {
            m_SelectLineRight = GameObject.Find("SelectLineR").GetComponent <M_MenuSelection>() as M_MenuSelection;
        }
        else
        {
            m_SelectLineRight = GameObject.Find("SelectLineR").AddComponent <M_MenuSelection>() as M_MenuSelection;
        }

        if (GameObject.Find("SelectPaint").GetComponent <M_MenuSelection>() != null)
        {
            m_SelectPaint = GameObject.Find("SelectPaint").GetComponent <M_MenuSelection>() as M_MenuSelection;
        }
        else
        {
            m_SelectPaint = GameObject.Find("SelectPaint").AddComponent <M_MenuSelection>() as M_MenuSelection;
        }

        m_DesiredStatus     = PauseMenuSelection.ReturnToGame;
        m_CurrentMenuStatus = PauseMenuSelection.ReturnToGame;

        m_FadePlane = GameObject.Find("FadePlane").GetComponent <Renderer>().material;

        m_DesiredStageName = Application.loadedLevelName;
    }