Beispiel #1
0
 public void StartGame()
 {
     Instance = this;
     Game     = GameModeBase.CreateGameMode(Mode);
     Game.Init();
     StartCoroutine(Game.GameLoop());
 }
Beispiel #2
0
    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);
    }
Beispiel #3
0
    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);
    }
Beispiel #4
0
 protected void InitGame()
 {
     Game.Init();
 }