예제 #1
0
    /// <summary>
    /// 通过玩家id获取所属的npc
    /// </summary>
    /// <param name="playerID"></param>
    /// <returns></returns>
    public void GetOwnNpcByPlayerID(uint playerID, ref List <INPC> lstNPC)
    {
        IEntitySystem es = ClientGlobal.Instance().GetEntitySystem();

        if (es == null)
        {
            return;
        }

        if (lstNPC == null)
        {
            return;
        }

        lstNPC.Clear();
        es.FindAllEntity <INPC>(ref m_npcList);
        for (int i = 0; i < m_npcList.Count; i++)
        {
            INPC npc = m_npcList[i];
            if (npc != null)
            {
                int masterID = npc.GetProp((int)NPCProp.Masterid);
                if (masterID == playerID)
                {
                    lstNPC.Add(npc);
                }
            }
        }
        m_npcList.Clear();
    }
예제 #2
0
        //-------------------------------------------------------------------------------------------------------

        /**
         * @brief 显示和隐藏怪物
         * @param
         */
        public static void ShowMonster(bool bShow)
        {
            if (EntitySystem.m_ClientGlobal == null)
            {
                return;
            }

            IEntitySystem es = EntitySystem.m_ClientGlobal.GetEntitySystem();

            if (es == null)
            {
                return;
            }

            List <INPC> lstMonster = null;

            if (lstMonster == null)
            {
                lstMonster = new List <INPC>();
            }
            lstMonster.Clear();
            es.FindAllEntity <INPC>(ref lstMonster);

            for (int i = 0; i < lstMonster.Count; ++i)
            {
                if (lstMonster[i] == null)
                {
                    continue;
                }

                if (!lstMonster[i].IsMonster())
                {
                    continue;
                }

                lstMonster[i].SendMessage(EntityMessage.EntityCommand_SetVisible, bShow);
            }
            lstMonster.Clear();
        }