コード例 #1
0
        //======================================================================

        public void CreateGame(GameParam param)
        {
            if (m_isRunning)
            {
                Debuger.LogError(LOG_TAG, "Create() Game Is Runing Already!");
                return;
            }

            Debuger.Log(LOG_TAG, "Create() param:{0}", param);

            //创建上下文,保存战斗全局参数
            m_context                   = new GameContext();
            m_context.param             = param;
            m_context.random.Seed       = param.randSeed;
            m_context.currentFrameIndex = 0;

            //创建地图
            m_map = new GameMap();
            m_map.Load(param.mapData);

            //初始化工厂
            EntityFactory.Init();
            ViewFactory.Init(GameObject.Find("EntityComponent").transform);

            m_isRunning = true;
        }
コード例 #2
0
        private void StartGame(GameMode mode)
        {
            GameParam param = new GameParam();

            param.mode        = mode;
            param.limitedTime = 10;

            m_game = new DrillGameMode();
            m_game.Start(param);
            m_game.onGameEnd += () => { StopGame(); };

            //打开UI
        }
コード例 #3
0
        public void Start(GameParam param)
        {
            GameManager.Instance.CreateGame(param);
            GameManager.Instance.onPlayerDie += OnPlayerDie;
            m_context = GameManager.Instance.Context;

            PlayerData pd = new PlayerData();

            pd.id          = m_MainPlayerId;
            pd.userId      = 123456;
            pd.shipData.id = 1;

            GameManager.Instance.RegPlayerData(pd);

            InputComponent.Instance.ShowInputPanel();
            InputComponent.OnVkey += OnVKey;

            CreatePlayer();
        }