void OnGUI() { switch(m_EState) { case EmenuState.e_splash: { if(m_fTempsSplash > 0.0f) { float fCoeffScale = 1.0f + (m_fTempsSplashInit - m_fTempsSplash)/(10.0f*m_fTempsSplashInit); float fWidth = m_fWidth * fCoeffScale; float fHeight = m_fHeight * fCoeffScale; GUI.DrawTexture(new Rect((m_fWidth - fWidth)/2.0f, (m_fHeight - fHeight)/2.0f, fWidth, fHeight), m_Texture_Splash); } else m_EState = EmenuState.e_main; break; } case EmenuState.e_main: { GUI.DrawTexture(new Rect(0, 0, m_fWidth, m_fHeight), m_Texture_Fond); if(Input.GetKeyDown(KeyCode.Space)) if(!m_bLaunchGame) { Application.LoadLevel(Application.loadedLevel+1); m_bLaunchGame = true; } break; } } }
// Use this for initialization void Start() { m_fTempsSplash = m_fTempsSplashInit; m_EState = EmenuState.e_splash; m_bLaunchGame = false; m_fWidth = CGame.m_fWidth; m_fHeight = CGame.m_fHeight; if(GameObject.Find("_Game") != null) Object.Destroy(GameObject.Find("_Game")); Debug.Log ("Start"); }
//------------------------------------------------------------------------------- /// Unity //------------------------------------------------------------------------------- void Start() { m_Game = gameObject.GetComponent <CGame>(); m_fTempsSplash = 0.0f; m_fTempsVideoIntro = 0.0f; m_bGamePaused = false; if (!m_Game.IsNotUseMasterGame()) { m_EState = EmenuState.e_menuState_splash; m_fTempsSplash = m_fTempsSplashInit; } else { m_EState = EmenuState.e_menuState_inGame; } }
void OnGUI() { switch(m_EState) { case EmenuState.e_splash: { if(m_fTempsSplash > 0.0f) { float fCoeffScale = 1.0f + (m_fTempsSplashInit - m_fTempsSplash)/(10.0f*m_fTempsSplashInit); float fWidth = m_fWidth * fCoeffScale; float fHeight = m_fHeight * fCoeffScale; GUI.DrawTexture(new Rect((m_fWidth - fWidth)/2.0f, (m_fHeight - fHeight)/2.0f, fWidth, fHeight), m_Texture_Splash); } else m_EState = EmenuState.e_main; break; } case EmenuState.e_main: { GUI.DrawTexture(new Rect(0, 0, m_fWidth, m_fHeight), m_Texture_Fond); if(Input.GetKeyDown(KeyCode.Space)) m_EState = EmenuState.e_Cinematique; break; } case EmenuState.e_Cinematique: { GUI.DrawTexture(new Rect(0, 0, 1280, 800), m_Texture_Cinematique); if(m_fTempsVideoIntro == 0.0f) m_Texture_Cinematique.Play(); if(m_Texture_Cinematique.isPlaying) { m_fTempsVideoIntro += Time.deltaTime; if(Input.GetKeyDown(KeyCode.Space) && m_fTempsVideoIntro>0.5f) m_Texture_Cinematique.Stop (); } else if(!m_bLaunchGame) { Application.LoadLevel(Application.loadedLevel+1); m_bLaunchGame = true; } break; } } }
//------------------------------------------------------------------------------- /// Unity //------------------------------------------------------------------------------- void OnGUI() { CGame game = gameObject.GetComponent <CGame>(); switch (m_EState) { case EmenuState.e_menuState_splash: { if (m_fTempsSplash > 0.0f) { float fCoeffScale = 1.0f + (m_fTempsSplashInit - m_fTempsSplash) / (10.0f * m_fTempsSplashInit); float fWidth = 1280 * fCoeffScale; float fHeight = 800 * fCoeffScale; GUI.DrawTexture(new Rect((1280 - fWidth) / 2.0f, (800 - fHeight) / 2.0f, fWidth, fHeight), m_Texture_Splash); } else { m_EState = EmenuState.e_menuState_movie; } break; } case EmenuState.e_menuState_movie: { GUI.DrawTexture(new Rect(0, 0, 1280, 800), m_Texture_movie_intro); if (m_fTempsVideoIntro == 0.0f) { m_Texture_movie_intro.Play(); } if (m_Texture_movie_intro.isPlaying) { m_fTempsVideoIntro += Time.deltaTime; } else { //m_Texture_movie_intro.Stop(); m_EState = EmenuState.e_menuState_main; } break; } case EmenuState.e_menuState_main: { GUI.DrawTexture(new Rect(0, 0, 1280, 800), m_Texture_Fond); if (GUI.Button(new Rect(390, 100, 500, 150), m_Texture_ButtonPlay)) { game.StartGame(); ResumeGame(); m_EState = EmenuState.e_menuState_inGame; } if (GUI.Button(new Rect(390, 400, 500, 150), m_Texture_ButtonCredit)) { m_EState = EmenuState.e_menuState_credits; } if (GUI.Button(new Rect(940, 10, 200, 60), m_Texture_ButtonMenu)) { m_EState = EmenuState.e_menuState_main; } if (GUI.Button(new Rect(1160, 10, 60, 60), m_Texture_ButtonQuit)) { Application.Quit(); } break; } case EmenuState.e_menuState_credits: { GUI.DrawTexture(new Rect(0, 0, 1280, 800), m_Texture_Credit); if (GUI.Button(new Rect(940, 10, 200, 60), m_Texture_ButtonMenu)) { m_EState = EmenuState.e_menuState_main; } if (GUI.Button(new Rect(1160, 10, 60, 60), m_Texture_ButtonQuit)) { Application.Quit(); } break; } case EmenuState.e_menuState_inGame: { //if (GUI.Button(new Rect(940, 10, 200, 60), m_Texture_ButtonMenu)) if (GUI.Button(new Rect(10, 10, 200, 60), m_Texture_ButtonMenu)) { m_EState = EmenuState.e_menuState_main; PauseGame(); } if (GUI.Button(new Rect(1160, 10, 60, 60), m_Texture_ButtonQuit)) { Application.Quit(); } if (GUI.Button(new Rect(250, 10, 60, 60), m_Texture_ButtonPause)) { if (!m_bGamePaused) { PauseGame(); } else { ResumeGame(); } } break; } } }
// Use this for initialization void Start() { m_fTempsSplash = m_fTempsSplashInit; m_EState = EmenuState.e_splash; m_fTempsVideoIntro = 0.0f; m_bLaunchGame = false; if(GameObject.Find("_Game") != null) Object.Destroy(GameObject.Find("_Game")); Debug.Log ("Start"); }