public static bool VisitFowVisibilityCheck(VCollisionSphere sphere, PoolObjHandle <ActorRoot> inActor, COM_PLAYERCAMP inHostCamp, GameFowManager fowMgr)
        {
            VInt2 zero = VInt2.zero;

            fowMgr.WorldPosToGrid(new VInt3(sphere.WorldPos.x, sphere.WorldPos.z, 0), out zero.x, out zero.y);
            int num = 0;

            fowMgr.m_pFieldObj.UnrealToGridX(sphere.WorldRadius, out num);
            for (int i = -num; i <= num; i++)
            {
                for (int j = -num; j <= num; j++)
                {
                    VInt2 b    = new VInt2(i, j);
                    VInt2 vInt = zero + b;
                    if (fowMgr.IsInsideSurface(vInt.x, vInt.y) && b.sqrMagnitude <= num * num)
                    {
                        bool flag = Singleton <GameFowManager> .instance.IsVisible(vInt.x, vInt.y, inHostCamp);

                        if (flag)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public static bool VisitFowVisibilityCheck(VCollisionBox box, PoolObjHandle <ActorRoot> inActor, COM_PLAYERCAMP inHostCamp, GameFowManager fowMgr)
        {
            VInt2 zero = VInt2.zero;

            if (fowMgr.WorldPosToGrid(new VInt3(box.WorldPos.x, box.WorldPos.z, 0), out zero.x, out zero.y))
            {
                FieldObj pFieldObj = fowMgr.m_pFieldObj;
                int      num       = 0;
                int      num2;
                pFieldObj.UnrealToGridX(box.WorldExtends.x, out num2);
                pFieldObj.UnrealToGridX(box.WorldExtends.z, out num);
                int num3 = zero.x - num2;
                num3 = Math.Max(0, num3);
                int num4 = zero.x + num2;
                num4 = Math.Min(num4, pFieldObj.NumX - 1);
                int num5 = zero.y - num;
                num5 = Math.Max(0, num5);
                int num6 = zero.y + num;
                num6 = Math.Min(num6, pFieldObj.NumY - 1);
                for (int i = num3; i <= num4; i++)
                {
                    for (int j = num5; j <= num6; j++)
                    {
                        bool flag = Singleton <GameFowManager> .get_instance().IsVisible(i, j, inHostCamp);

                        if (flag)
                        {
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
        public static bool VisitFowVisibilityCheck(VCollisionCylinderSector cylinder, PoolObjHandle <ActorRoot> inActor, COM_PLAYERCAMP inHostCamp, GameFowManager fowMgr)
        {
            VInt2 zero = VInt2.zero;

            fowMgr.WorldPosToGrid(new VInt3(cylinder.WorldPos.x, cylinder.WorldPos.z, 0), out zero.x, out zero.y);
            float num = (float)cylinder.Radius;

            num *= 0.001f;
            num *= num;
            Vector3 vector = (Vector3)cylinder.WorldPos;
            float   num2   = (float)cylinder.Degree;

            num2 *= 0.5f;
            num2  = Mathf.Cos(num2);
            Vector3  vector2   = (Vector3)cylinder.WorldPos;
            Vector3  vector3   = (Vector3)inActor.handle.forward;
            FieldObj pFieldObj = fowMgr.m_pFieldObj;
            int      num3      = 0;

            pFieldObj.UnrealToGridX(cylinder.Radius, out num3);
            int num4 = zero.x - num3;

            num4 = Math.Max(0, num4);
            int num5 = zero.x + num3;

            num5 = Math.Min(num5, pFieldObj.NumX - 1);
            int num6 = zero.y - num3;

            num6 = Math.Max(0, num6);
            int num7 = zero.y + num3;

            num7 = Math.Min(num7, pFieldObj.NumY - 1);
            for (int i = num4; i <= num5; i++)
            {
                for (int j = num6; j <= num7; j++)
                {
                    bool flag = Singleton <GameFowManager> .instance.IsVisible(i, j, inHostCamp);

                    if (flag && GameFowCollector.IsPointInCircularSector2(vector.x, vector.z, vector3.x, vector3.z, num, num2, vector2.x, vector2.z))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }