Exemplo n.º 1
0
        //---------------------------------------------------------------------------------------------

        protected override void OnStart()
        {
            ServerStorySystem.ThreadInitMask();
            m_GmStorySystem.Init(this);
            m_StorySystem.Init(this);
            m_StorySystem.StartStory("user_main");
        }
        private void LoadObjects()
        {
            LogSys.Log(LOG_TYPE.DEBUG, "Scene {0} start Running.", m_SceneResId);
            m_GameTime.Start();
            m_SceneContext.StartTime = m_GameTime.StartTime;

            for (int campId = (int)CampIdEnum.Friendly; campId <= (int)CampIdEnum.Red; ++campId)
            {
                int key = this.SceneResId * 10 + campId;
                List <TableConfig.LevelMonster> monsters;
                if (TableConfig.LevelMonsterProvider.Instance.TryGetValue(key, out monsters))
                {
                    for (int i = 0; i < monsters.Count; ++i)
                    {
                        TableConfig.LevelMonster monster = monsters[i];
                        if (null != monster)
                        {
                            TableConfig.Actor actor = TableConfig.ActorProvider.Instance.GetActor(monster.actorID);
                            if (null != actor)
                            {
                                int        unitId = campId * 10000 + i;
                                EntityInfo npc    = EntityManager.AddEntity(unitId, campId, actor, (int)AiStateLogicId.Entity_General);
                                if (null != npc)
                                {
                                    npc.IsPassive        = monster.passive;
                                    npc.LevelMonsterData = monster;
                                    npc.SetLevel(monster.level);
                                    npc.GetMovementStateInfo().SetPosition2D(monster.x, monster.y);
                                    npc.GetMovementStateInfo().SetFaceDir(Geometry.DegreeToRadian(monster.dir));
                                }
                            }
                        }
                    }
                }
            }

            ServerStorySystem.ThreadInitMask();
            m_StorySystem.ClearStoryInstancePool();
            m_StorySystem.PreloadSceneStories();
            m_StorySystem.StartStory("local_main");
            m_StorySystem.StartStory("story_main");
        }
Exemplo n.º 3
0
        private void LoadObjects()
        {
            LogSys.Log(LOG_TYPE.DEBUG, "Scene {0} start Running.", m_SceneResId);
            m_GameTime.Start();
            m_SceneContext.StartTime = m_GameTime.StartTime;

            for (int campId = (int)CampIdEnum.Friendly; campId <= (int)CampIdEnum.Red; ++campId)
            {
                int key = this.SceneResId * 10 + campId;
                List <TableConfig.LevelMonster> monsters;
                if (TableConfig.LevelMonsterProvider.Instance.TryGetValue(key, out monsters))
                {
                    for (int i = 0; i < monsters.Count; ++i)
                    {
                        TableConfig.LevelMonster monster = monsters[i];
                        if (null != monster)
                        {
                            int        unitId = campId * 10000 + i;
                            int        objId  = CreateEntity(unitId, monster.x, 0.0f, monster.y, monster.dir, campId, monster.actorID, monster.aiLogic, monster.aiParams.ToArray());
                            EntityInfo npc    = GetEntityById(objId);
                            if (null != npc)
                            {
                                npc.IsPassive        = monster.passive;
                                npc.LevelMonsterData = monster;
                                npc.Level            = monster.level;
                            }
                        }
                    }
                }
            }

            ServerStorySystem.ThreadInitMask();
            m_StorySystem.ClearStoryInstancePool();
            m_StorySystem.PreloadSceneStories();
            m_StorySystem.StartStory("local_main");
            m_StorySystem.StartStory("story_main");
        }