private SubGame GetSubGameInstance(ESubGame type) { SubGame subGame = null; switch (type) { case ESubGame.SplashScreen: subGame = new Splash(); break; case ESubGame.Login: subGame = new Login(); break; case ESubGame.Match: subGame = new Match(); break; case ESubGame.Battle: subGame = new Battle(); break; case ESubGame.SelectLevel: subGame = new SelectLevel(); break; default: Debug.LogError("Unsupported SubGame Type!"); break; } return(subGame); }
public SubGame(ESubGame type) { m_subGameType = type; m_bSceneLoaded = false; m_bPreAdaptResolution = false; m_bAdaptResolution = false; m_timer = new Timer(); }
public void UpdateGame(float fDeltaTime) { // FPS temp code { ++m_fpsCount; m_fpsTimer += Time.deltaTime; if (m_fpsTimer >= 0.5f) { TestScene.ShowLabel("FPS", (m_fpsCount / m_fpsTimer).ToString("f2")); m_fpsCount = 0; m_fpsTimer = 0f; } } // switch subgame if (m_newSubGameType != m_curSubGameType && m_newSubGameType != ESubGame.None) { if (m_curSubGame != null) { m_curSubGame.Destroy(); m_curSubGame = null; } m_curSubGame = GetSubGameInstance(m_newSubGameType); m_curSubGame.Init(); m_curSubGameType = m_newSubGameType; } // update subgame if (m_curSubGame != null && !m_gamePause) { m_curSubGame.Update(fDeltaTime); } if (m_curSubGameType != ESubGame.SplashScreen) { NetworkMgr.Instance.Update(fDeltaTime); //EducationServer.Instance.Update(fDeltaTime); //AntiAddiction.Instance.Update(fDeltaTime); } }
public void SwitchToSubgame(ESubGame subgame) { m_newSubGameType = subgame; }