public void StartGame() { Instance = this; Game = GameModeBase.CreateGameMode(Mode); Game.Init(); StartCoroutine(Game.GameLoop()); }
public GameModeBase LoadGameMode(Type t, GameModeInitData initData) { if (!t.IsSubclassOf(typeof(GameModeBase))) { Debug.Log("type is not a game mode"); return(null); } //if(t == mGameMode.GetType()) //{ // //相同模式 说明不变 // return mGameMode; //} GameModeBase preGm = mGameMode; mGameMode = (GameModeBase)Activator.CreateInstance(t); if (mGameMode == null) { Debug.LogError("Load Game Mode " + t.FullName + " fail"); return(null); } mGameMode.Init(initData); if (preGm != null) { preGm.OnRelease(); } return(mGameMode); }
public GameModeBase LoadGameMode(Type t) { if (!t.IsSubclassOf(typeof(GameModeBase))) { Debug.Log("type is not a game mode"); return(null); } GameModeBase preGm = mGameMode; mGameMode = (GameModeBase)Activator.CreateInstance(t); if (mGameMode == null) { Debug.LogError("Load Game Mode " + t.FullName + " fail"); return(null); } mGameMode.Init(); if (preGm != null) { preGm.OnRelease(); } return(mGameMode); }
protected void InitGame() { Game.Init(); }