SetStateFlag() public method

public SetStateFlag ( Operate_Type opType, CharacterState_Type mask ) : void
opType Operate_Type
mask CharacterState_Type
return void
示例#1
0
        internal void AddState(int objId, string state)
        {
            EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId);

            if (null != entity)
            {
                entity.SetStateFlag(Operate_Type.OT_AddBit, CharacterStateUtility.FromString(state));
            }
        }
示例#2
0
        internal void AddState(int objId, string state)
        {
            EntityViewModel view = GetEntityViewById(objId);

            if (null != view && null != view.Entity)
            {
                EntityInfo entity = view.Entity;
                entity.SetStateFlag(Operate_Type.OT_AddBit, CharacterStateUtility.FromString(state));
            }
        }
示例#3
0
        internal void BornFinish(int objId)
        {
            EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId);

            if (null != entity)
            {
                entity.IsBorning = false;
                entity.SetAIEnable(true);
                entity.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible);
            }
        }
示例#4
0
        public EntityInfo DelayAddEntity(int id, int unitId, int camp, TableConfig.Actor cfg, int ai, params string[] aiParams)
        {
            EntityInfo entity = NewEntityInfo(id);

            entity.SceneContext = m_SceneContext;
            entity.LoadData(unitId, camp, cfg, ai, aiParams);
            entity.IsBorning = true;
            entity.BornTime  = 0;
            entity.SetAIEnable(false);
            entity.SetStateFlag(Operate_Type.OT_AddBit, CharacterState_Type.CST_Invincible);
            m_DelayAdd.Add(entity);
            return(entity);
        }
示例#5
0
        internal void BornFinish(int objId)
        {
            EntityViewModel view = GetEntityViewById(objId);

            if (null != view)
            {
                EntityInfo entity = view.Entity;
                if (null != entity)
                {
                    entity.IsBorning = false;
                    entity.SetAIEnable(true);
                    entity.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible);
                }
            }
        }
示例#6
0
        internal void RemoveState(int objId, string state)
        {
            EntityInfo entity = m_Scene.EntityManager.GetEntityInfo(objId);

            if (null != entity)
            {
                if (string.IsNullOrEmpty(state))
                {
                    entity.StateFlag = 0;
                }
                else
                {
                    entity.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterStateUtility.FromString(state));
                }
            }
        }
示例#7
0
        internal void RemoveState(int objId, string state)
        {
            EntityViewModel view = GetEntityViewById(objId);

            if (null != view && null != view.Entity)
            {
                EntityInfo entity = view.Entity;
                if (string.IsNullOrEmpty(state))
                {
                    entity.StateFlag = 0;
                }
                else
                {
                    entity.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterStateUtility.FromString(state));
                }
            }
        }
示例#8
0
 private void TickEntities()
 {
     m_DeletedEntities.Clear();
     for (LinkedListNode <EntityInfo> linkNode = m_EntityManager.Entities.FirstValue; null != linkNode; linkNode = linkNode.Next)
     {
         EntityInfo info = linkNode.Value;
         info.RetireAttackerInfos(10000);
         if (info.LevelChanged || info.GetSkillStateInfo().BuffChanged)
         {
             AttrCalculator.Calc(info);
             info.LevelChanged = false;
             info.GetSkillStateInfo().BuffChanged = false;
         }
         if (info.IsBorning)
         {
             if (info.BornTime <= 0)
             {
                 SkillInfo skillInfo = info.GetSkillStateInfo().GetSkillInfoById(info.BornSkillId);
                 if (info.BornSkillId > 0 && null != skillInfo)
                 {
                     info.BornTime = TimeUtility.GetLocalMilliseconds();
                     GfxSkillSystem.Instance.StartSkill(info.GetId(), skillInfo.ConfigData, 0);
                 }
                 else
                 {
                     info.IsBorning = false;
                     info.BornTime  = 0;
                     info.SetAIEnable(true);
                     info.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible);
                 }
             }
             else if (info.BornTime + info.BornTimeout < TimeUtility.GetLocalMilliseconds())
             {
                 info.IsBorning = false;
                 info.BornTime  = 0;
                 info.SetAIEnable(true);
                 info.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible);
             }
         }
         if (info.IsDead() && !info.NeedDelete)
         {
             if (info.CanDead)
             {
                 if (info.DeadTime <= 0)
                 {
                     SkillInfo skillInfo = info.GetSkillStateInfo().GetSkillInfoById(info.DeadSkillId);
                     if (info.DeadSkillId > 0 && null != skillInfo)
                     {
                         info.DeadTime = TimeUtility.GetLocalMilliseconds();
                         GfxSkillSystem.Instance.StopAllSkill(info.GetId(), true, false, true);
                         GfxSkillSystem.Instance.StartSkill(info.GetId(), skillInfo.ConfigData, 0);
                         OnEntityKilled(info);
                         EntityDrop(info); // 掉落
                     }
                     else
                     {
                         info.DeadTime   = 0;
                         info.NeedDelete = true;
                         OnEntityKilled(info);
                         EntityDrop(info); // 掉落
                     }
                 }
                 else if (info.DeadTime + info.DeadTimeout < TimeUtility.GetLocalMilliseconds())
                 {
                     info.DeadTime   = 0;
                     info.NeedDelete = true;
                 }
             }
             else
             {
                 info.CanDead = true;
             }
         }
         else
         {
             //每个tick复位CanDead,技能里需要鞭尸时应使用触发器每帧标记目标不可死亡(keeplive)
             info.CanDead = true;
         }
         if (info.NeedDelete)
         {
             m_DeletedEntities.Add(info);
         }
     }
     if (m_DeletedEntities.Count > 0)
     {
         int enemyCt  = 0;
         int friendCt = 0;
         for (int i = 0; i < m_DeletedEntities.Count; ++i)
         {
             EntityInfo ni = m_DeletedEntities[i];
             if (CharacterRelation.RELATION_ENEMY == EntityInfo.GetRelation(CampId, ni.GetCampId()))
             {
                 ++enemyCt;
             }
             else if (CharacterRelation.RELATION_FRIEND == EntityInfo.GetRelation(CampId, ni.GetCampId()))
             {
                 ++friendCt;
             }
             DestroyEntity(ni);
         }
         TryAllKilledOrAllDied(enemyCt > 0, friendCt > 0);
     }
 }
示例#9
0
        private void TickEntities()
        {
            m_DeletedEntities.Clear();
            for (LinkedListNode <EntityInfo> linkNode = m_EntityMgr.Entities.FirstValue; null != linkNode; linkNode = linkNode.Next)
            {
                EntityInfo info = linkNode.Value;
                info.RetireAttackerInfos(60000);
                if (info.LevelChanged || info.GetSkillStateInfo().BuffChanged)
                {
                    AttrCalculator.Calc(info);
                    info.LevelChanged = false;
                    info.GetSkillStateInfo().BuffChanged = false;
                }
                if (info.IsBorning)
                {
                    if (info.BornTime <= 0)
                    {
                        SkillInfo skillInfo = info.GetSkillStateInfo().GetSkillInfoById(info.BornSkillId);
                        if (info.BornSkillId > 0 && null != skillInfo)
                        {
                            info.BornTime = TimeUtility.GetLocalMilliseconds();
                            m_SkillSystem.StartSkill(info.GetId(), skillInfo.ConfigData, 0);
                        }
                        else
                        {
                            info.IsBorning = false;
                            info.BornTime  = 0;
                            info.SetAIEnable(true);
                            info.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible);
                        }
                    }
                    else if (info.BornTime + info.BornTimeout < TimeUtility.GetLocalMilliseconds())
                    {
                        info.IsBorning = false;
                        info.BornTime  = 0;
                        info.SetAIEnable(true);
                        info.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible);
                    }
                }
                if (info.IsDead() && !info.NeedDelete)
                {
                    if (info.DeadTime <= 0)
                    {
                        CalcKillIncome(info);
                        //发送npc死亡消息
                        Msg_RC_NpcDead npcDeadBuilder = new Msg_RC_NpcDead();
                        npcDeadBuilder.npc_id = info.GetId();
                        NotifyAllUser(RoomMessageDefine.Msg_RC_NpcDead, npcDeadBuilder);

                        SkillInfo skillInfo = info.GetSkillStateInfo().GetSkillInfoById(info.DeadSkillId);
                        if (info.DeadSkillId > 0 && null != skillInfo)
                        {
                            info.DeadTime = TimeUtility.GetLocalMilliseconds();
                            m_SkillSystem.StopAllSkill(info.GetId(), true, false, true);
                            m_SkillSystem.StartSkill(info.GetId(), skillInfo.ConfigData, 0);
                            OnEntityKilled(info);
                        }
                        else
                        {
                            if (null == info.CustomData as User)
                            {
                                info.DeadTime   = 0;
                                info.NeedDelete = true;
                                OnEntityKilled(info);
                            }
                            else
                            {
                                info.DeadTime = TimeUtility.GetLocalMilliseconds();
                            }
                        }
                    }
                    else
                    {
                        if (null == info.CustomData as User && info.DeadTime + info.DeadTimeout < TimeUtility.GetLocalMilliseconds())
                        {
                            info.DeadTime   = 0;
                            info.NeedDelete = true;

                            //重新发送npc死亡消息
                            Msg_RC_NpcDead npcDeadBuilder = new Msg_RC_NpcDead();
                            npcDeadBuilder.npc_id = info.GetId();
                            NotifyAllUser(RoomMessageDefine.Msg_RC_NpcDead, npcDeadBuilder);
                        }
                        else if (null != info.CustomData as User && info.DeadTime + info.ReliveTimeout < TimeUtility.GetLocalMilliseconds())
                        {
                            info.DeadTime = 0;
                            info.SetHp(Operate_Type.OT_Absolute, info.GetActualProperty().HpMax);
                            info.SetEnergy(Operate_Type.OT_Absolute, info.GetActualProperty().EnergyMax);

                            Msg_RC_SyncProperty npcProp = DataSyncUtility.BuildSyncPropertyMessage(info);
                            NotifyAllUser(RoomMessageDefine.Msg_RC_SyncProperty, npcProp);
                        }
                    }
                }
                if (info.NeedDelete)
                {
                    m_DeletedEntities.Add(info);
                }
            }
            if (m_DeletedEntities.Count > 0)
            {
                int enemyCt  = 0;
                int friendCt = 0;
                Msg_RC_DestroyNpc destroyNpcBuilder = new Msg_RC_DestroyNpc();
                for (int i = 0; i < m_DeletedEntities.Count; ++i)
                {
                    EntityInfo ni = m_DeletedEntities[i];
                    if (CharacterRelation.RELATION_ENEMY == EntityInfo.GetRelation((int)CampIdEnum.Blue, ni.GetCampId()))
                    {
                        ++enemyCt;
                    }
                    else if (CharacterRelation.RELATION_FRIEND == EntityInfo.GetRelation((int)CampIdEnum.Blue, ni.GetCampId()))
                    {
                        ++friendCt;
                    }
                    //发送npc消失消息
                    destroyNpcBuilder.npc_id = ni.GetId();
                    NotifyAllUser(RoomMessageDefine.Msg_RC_DestroyNpc, destroyNpcBuilder);
                    DestroyEntity(ni);
                }
                TryAllKilledOrAllDied(enemyCt > 0, friendCt > 0);
            }
            m_EntityMgr.ExecuteDelayAdd();
        }