Beispiel #1
0
        public void Tick()
        {
            List <UserInfo> list;

            if (camp_users_.TryGetValue((int)CampIdEnum.Blue, out list))
            {
                int ct = list.Count;
                for (int i = 0; i < ct; ++i)
                {
                    UserInfo user = list[i];
                    user.PrepareUpdateSight();
                }
            }
            if (camp_users_.TryGetValue((int)CampIdEnum.Red, out list))
            {
                int ct = list.Count;
                for (int i = 0; i < ct; ++i)
                {
                    UserInfo user = list[i];
                    user.PrepareUpdateSight();
                }
            }
            for (LinkedListNode <NpcInfo> node = npc_manager_.Npcs.FirstValue; null != node; node = node.Next)
            {
                NpcInfo npc = node.Value;
                if (null != npc)
                {
                    npc.PrepareUpdateSight();
                }
            }
            if (camp_users_.TryGetValue((int)CampIdEnum.Blue, out list))
            {
                int ct = list.Count;
                for (int i = 0; i < ct; ++i)
                {
                    UserInfo user = list[i];
                    CalcSight(user);
                }
            }
            if (camp_users_.TryGetValue((int)CampIdEnum.Red, out list))
            {
                int ct = list.Count;
                for (int i = 0; i < ct; ++i)
                {
                    UserInfo user = list[i];
                    CalcSight(user);
                }
            }
            for (LinkedListNode <NpcInfo> node = npc_manager_.Npcs.FirstValue; null != node; node = node.Next)
            {
                NpcInfo npc = node.Value;
                if (null != npc)
                {
                    //先保留对塔的计算(应该没必要)
                    if (npc.NpcType == (int)NpcTypeEnum.PvpTower)
                    {
                        npc.CurBlueCanSeeMe = true;
                        npc.CurRedCanSeeMe  = true;
                    }
                    CalcSight(npc);
                }
            }
        }