Exemplo n.º 1
0
        private static bool CanSee(CharacterInfo src, CharacterInfo target)
        {
            int srcCampId    = src.GetCampId();
            int targetCampId = target.GetCampId();

            if (srcCampId == targetCampId)
            {
                return(true);
            }
            else if (srcCampId == (int)CampIdEnum.Hostile || targetCampId == (int)CampIdEnum.Hostile)
            {
                return(CharacterInfo.CanSee(src, target));
            }
            else
            {
                bool isBlue = (targetCampId == (int)CampIdEnum.Blue);
                if (isBlue && target.CurRedCanSeeMe || !isBlue && target.CurBlueCanSeeMe)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Exemplo n.º 2
0
            public void Visit(CharacterInfo obj)
            {
                if (self_ == obj)
                {
                    return;
                }
                NpcInfo npc = obj.CastNpcInfo();

                if (null != npc && npc.NpcType == (int)NpcTypeEnum.PvpTower)//塔不需要放在可见对象表中(全场景可见)
                {
                    return;
                }

                /*if (self_.IsUser && obj.IsUser) {
                 * LogSystem.Debug("Sight:{0}({1},{2}) see {3}({4},{5})", self_.GetLinkId(), self_.SightCell.row, self_.SightCell.col, obj.GetLinkId(), obj.SightCell.row, obj.SightCell.col);
                 * }*/
                bool isblue = (sight_camp_ == (int)CampIdEnum.Blue);
                int  objId  = obj.GetId();

                if (obj.GetCampId() != sight_camp_ && (isblue && !obj.CurBlueCanSeeMe || !isblue && !obj.CurRedCanSeeMe))
                {
                    Vector3 posd    = obj.GetMovementStateInfo().GetPosition3D();
                    float   distSqr = DashFire.Geometry.DistanceSquare(pos_, posd);
                    if (CharacterInfo.CanSee(self_, obj, distSqr, pos_, posd))
                    {
                        if (isblue)
                        {
                            obj.CurBlueCanSeeMe = true;
                        }
                        else
                        {
                            obj.CurRedCanSeeMe = true;
                        }
                    }
                }
            }