Example #1
0
        public void PlayParticle(string particlename, float x, float y, float z, float duration)
        {
            if (!CanAffectPlayerSelf)
            {
                return;
            }
            TemporaryEffectArgs args = new TemporaryEffectArgs(particlename, duration, x, y, z);

            GfxSystem.SendMessage("GfxGameRoot", "AddTemporaryEffect", args);
        }
Example #2
0
        public void CreatePlayerSelfView(int objId)
        {
            CreateUserView(objId);
            UserView view = GetUserViewById(objId);

            if (null != view)
            {
                GfxSystem.SendMessage("GfxGameRoot", "CameraFollow", view.Actor);
            }
        }
Example #3
0
        private void OnNpcMeetEnemy(NpcInfo npc, Animation_Type animType)
        {
            CharacterView view = EntityManager.Instance.GetCharacterViewById(npc.GetId());

            if (null != view)
            {
                GfxSystem.SendMessage(view.Actor, "OnMeetEnemy", null);
            }
            view.PlayAnimation(animType);
            view.PlayQueuedAnimation(Animation_Type.AT_Stand);
        }
Example #4
0
 private void NpcSkill(NpcInfo npc, int skillId, CharacterInfo target)
 {
     if (null != npc)
     {
         CharacterView view = EntityManager.Instance.GetCharacterViewById(npc.GetId());
         if (null != view)
         {
             SkillParam param = new SkillParam();
             param.SkillId  = skillId;
             param.TargetId = target.GetId();
             GfxSystem.SendMessage(view.Actor, "MonsterStartSkill", param);
         }
     }
 }
Example #5
0
 public void SwitchObserver()
 {
     if (m_IsObserver)
     {
         m_IsFollowObserver = !m_IsFollowObserver;
         if (m_IsFollowObserver)
         {
             LinkedListNode <UserInfo> node = null;
             for (node = UserManager.Users.FirstValue; null != node; node = node.Next)
             {
                 if (node.Value == m_PlayerSelf)
                 {
                     continue;
                 }
                 if (node.Value.GetId() == m_FollowTargetId)
                 {
                     break;
                 }
             }
             if (null == node)
             {
                 for (node = UserManager.Users.FirstValue; null != node; node = node.Next)
                 {
                     if (node.Value == m_PlayerSelf)
                     {
                         continue;
                     }
                     else
                     {
                         break;
                     }
                 }
             }
             if (null != node)
             {
                 m_FollowTargetId = node.Value.GetId();
                 GfxSystem.PublishGfxEvent("ge_pvpSelfCombatInfo", "ui", node.Value.GetCombatStatisticInfo());
                 if (!node.Value.IsDead())
                 {
                     UserView view = EntityManager.Instance.GetUserViewById(m_FollowTargetId);
                     if (null != view)
                     {
                         GfxSystem.SendMessage("GfxGameRoot", "CameraFollow", view.Actor);
                     }
                 }
             }
         }
     }
 }
Example #6
0
        private void TickNpcs()
        {
            List <NpcInfo> deletes = new List <NpcInfo>();

            for (LinkedListNode <NpcInfo> linkNode = m_NpcMgr.Npcs.FirstValue; null != linkNode; linkNode = linkNode.Next)
            {
                NpcInfo info = linkNode.Value;
                if (info.LevelChanged || info.GetShootStateInfo().WeaponChanged || info.GetSkillStateInfo().BuffChanged || info.GetEquipmentStateInfo().EquipmentChanged)
                {
                    NpcAttrCalculator.Calc(info);
                    info.LevelChanged = false;
                    info.GetShootStateInfo().WeaponChanged        = false;
                    info.GetSkillStateInfo().BuffChanged          = false;
                    info.GetEquipmentStateInfo().EquipmentChanged = false;
                }

                // 约定npc的高度低于140时,直接判定npc死亡。
                if (140.0f > info.GetMovementStateInfo().GetPosition3D().Y)
                {
                    info.SetHp(Operate_Type.OT_Absolute, 0);
                }
                if (info.NeedDelete)
                {
                    deletes.Add(info);
                }
                else if (info.Hp <= 0)
                {
                    if (!info.LogicDead)
                    {
                        GfxSystem.PublishGfxEvent("ge_on_npc_dead", "story", info.GetUnitId());
                        info.LogicDead = true;
                    }
                    if (info.DeadTime <= 0)
                    {
                    }
                    else if (TimeUtility.GetServerMilliseconds() - info.DeadTime > info.ReleaseTime)
                    {
                        deletes.Add(info);
                    }
                }
                if (info.IsBorning && IsNpcBornOver(info))
                {
                    info.IsBorning = false;
                    info.SetAIEnable(true);
                    info.SetStateFlag(Operate_Type.OT_RemoveBit, CharacterState_Type.CST_Invincible);
                }
            }
            if (deletes.Count > 0)
            {
                foreach (NpcInfo ni in deletes)
                {
                    CharacterView view = EntityManager.Instance.GetCharacterViewById(ni.GetId());
                    if (null != view)
                    {
                        GfxSystem.SendMessage(view.Actor, "OnDead", null);
                    }
                    EntityManager.Instance.DestroyNpcView(ni.GetId());
                    WorldSystem.Instance.DestroyCharacterById(ni.GetId());
                    return;
                }
            }
        }