public void ReloadObjects()
        {
            if (m_PreparedReloadMonsterCount > 0)
            {
                for (int i = 0; i < m_PreparedReloadMonsterCount; ++i)
                {
                    TableConfig.LevelMonster monster = m_PreparedReloadMonsters[i];
                    if (null != monster)
                    {
                        int        campId = monster.camp;
                        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;

                            Msg_RC_CreateNpc msg = DataSyncUtility.BuildCreateNpcMessage(npc);
                            NotifyAllUser(RoomMessageDefine.Msg_RC_CreateNpc, msg);

                            Msg_RC_SyncProperty msg2 = DataSyncUtility.BuildSyncPropertyMessage(npc);
                            NotifyAllUser(RoomMessageDefine.Msg_RC_SyncProperty, msg2);
                        }
                    }
                }
                m_PreparedReloadMonsterCount = 0;
            }
            while (m_ReloadMonstersQueue.Count > 0 && m_PreparedReloadMonsterCount < c_MaxReloadMonsterNum)
            {
                m_PreparedReloadMonsters[m_PreparedReloadMonsterCount++] = m_ReloadMonstersQueue.Dequeue();
            }
        }
Example #2
0
 private void OnDestroyEntity(EntityInfo entity)
 {
     if (null != entity)
     {
         TableConfig.LevelMonster monster = entity.LevelMonsterData;
         if (null != monster)
         {
             ReloadMonstersQueue.Enqueue(monster);
         }
     }
 }
        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");
        }
Example #4
0
        internal void ReloadObjects()
        {
            if (m_PreparedReloadMonsterCount > 0)
            {
                for (int i = 0; i < m_PreparedReloadMonsterCount; ++i)
                {
                    TableConfig.LevelMonster monster = m_PreparedReloadMonsters[i];
                    if (null != monster)
                    {
                        int campId = monster.camp;
                        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(monster.dir);

                                Msg_RC_CreateNpc msg = DataSyncUtility.BuildCreateNpcMessage(npc);
                                NotifyAllUser(RoomMessageDefine.Msg_RC_CreateNpc, msg);

                                Msg_RC_SyncProperty msg2 = DataSyncUtility.BuildSyncPropertyMessage(npc);
                                NotifyAllUser(RoomMessageDefine.Msg_RC_SyncProperty, msg2);
                            }
                        }
                    }
                }
                m_PreparedReloadMonsterCount = 0;
            }
            while (m_ReloadMonstersQueue.Count > 0 && m_PreparedReloadMonsterCount < c_MaxReloadMonsterNum)
            {
                m_PreparedReloadMonsters[m_PreparedReloadMonsterCount++] = m_ReloadMonstersQueue.Dequeue();
            }
        }
Example #5
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");
        }
        public void Reset()
        {
            m_IsBorning = false;
            m_NeedDelete = false;
            m_BornTime = 0;
            m_DropMoney = 0;

            m_CanMove = true;
            m_CanRotate = true;
            m_CanHitMove = true;
            m_CanDead = true;

            m_IsPassive = false;

            m_IsServerEntity = true;
            m_LevelMonsterData = null;

            m_CreatorId = 0;
            m_BornSkillId = 0;
            m_DeadSkillId = 0;
            m_NormalSkillId = 0;
            m_EntityType = 0;
            m_Scale = 1.0f;

            m_AutoSkillIds.Clear();
            m_PassiveSkillIds.Clear();

            ResetBaseInfo();
            GetAiStateInfo().Reset();
        }