Exemplo n.º 1
0
        // Token: 0x0600007B RID: 123 RVA: 0x00006088 File Offset: 0x00004288
        public static Vector3 GetOrthogonalVector(Vector3 vCenter, Vector3 vPoint)
        {
            Vector3 a        = vCenter - vPoint;
            double  distance = VectorUtilities.GetDistance(vCenter, vPoint);

            return(a / (float)distance);
        }
Exemplo n.º 2
0
        // Token: 0x060000A5 RID: 165 RVA: 0x00007A20 File Offset: 0x00005C20
        public static bool GetRaycast(GameObject Target, Vector3 StartPos, out Vector3 Point)
        {
            Point = Vector3.zero;
            bool flag  = Target == null;
            bool flag2 = flag;
            bool result;

            if (flag2)
            {
                result = false;
            }
            else
            {
                int layer = Target.layer;
                Target.layer = LayerMasks.AGENT;
                RaycastComponent Component = Target.GetComponent <RaycastComponent>();
                bool             flag3     = VectorUtilities.GetDistance(Target.transform.position, StartPos) <= 15.5;
                bool             flag4     = flag3;
                if (flag4)
                {
                    Point  = OptimizationVariables.MainPlayer.transform.position;
                    result = true;
                }
                else
                {
                    Vector3[] vertices = Component.Sphere.GetComponent <MeshCollider>().sharedMesh.vertices;
                    foreach (Vector3 vector in (from v in vertices
                                                select Component.Sphere.transform.TransformPoint(v)).ToArray <Vector3>())
                    {
                        Vector3 direction = VectorUtilities.Normalize(vector - StartPos);
                        double  distance  = VectorUtilities.GetDistance(StartPos, vector);
                        bool    flag1337  = Physics.Raycast(StartPos, direction, (float)distance + 0.5f, RayMasks.DAMAGE_CLIENT);
                        if (!flag1337)
                        {
                            Target.layer = layer;
                            Point        = vector;
                            return(true);
                        }
                    }
                    Target.layer = layer;
                    result       = false;
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        // Token: 0x06000074 RID: 116 RVA: 0x00005F60 File Offset: 0x00004160
        public static LocationNode GetClosestLocation(Vector3 pos)
        {
            double       num    = 1337420.0;
            LocationNode result = null;

            foreach (LocationNode locationNode in (from n in LevelNodes.nodes
                                                   where n.type == ENodeType.LOCATION
                                                   select(LocationNode) n).ToArray <LocationNode>())
            {
                double distance = VectorUtilities.GetDistance(pos, locationNode.point);
                bool   flag     = distance < num;
                bool   flag2    = flag;
                if (flag2)
                {
                    num    = distance;
                    result = locationNode;
                }
            }
            return(result);
        }
        // Token: 0x06000097 RID: 151 RVA: 0x00006D0C File Offset: 0x00004F0C
        public static bool GetTargetObject(GameObject[] Objects, out GameObject Object, out Vector3 Point, double Range)
        {
            double num  = Range + 1.0;
            double num2 = 180.0;

            Object = null;
            Point  = Vector3.zero;
            Vector3 position = OptimizationVariables.MainPlayer.look.aim.position;
            Vector3 forward  = OptimizationVariables.MainPlayer.look.aim.forward;

            foreach (GameObject gameObject in Objects)
            {
                bool flag = !(gameObject == null);
                if (flag)
                {
                    Vector3 position2 = gameObject.transform.position;
                    Player  component = gameObject.GetComponent <Player>();
                    bool    flag2     = !component || (!component.life.isDead && !FriendUtilities.IsFriendly(component) && (!RaycastOptions.NoShootthroughthewalls || RaycastUtilities.NoShootthroughthewalls(gameObject.transform)));
                    if (flag2)
                    {
                        Zombie component2 = gameObject.GetComponent <Zombie>();
                        bool   flag3      = !component2 || !component2.isDead;
                        if (flag3)
                        {
                            bool flag4 = gameObject.GetComponent <RaycastComponent>() == null;
                            if (flag4)
                            {
                                gameObject.AddComponent <RaycastComponent>();
                            }
                            else
                            {
                                double distance = VectorUtilities.GetDistance(position, position2);
                                bool   flag5    = distance <= Range;
                                if (flag5)
                                {
                                    bool silentAimUseFOV = RaycastOptions.SilentAimUseFOV;
                                    if (silentAimUseFOV)
                                    {
                                        double angleDelta = VectorUtilities.GetAngleDelta(position, forward, position2);
                                        bool   flag6      = angleDelta > (double)RaycastOptions.SilentAimFOV || angleDelta > num2;
                                        if (flag6)
                                        {
                                            goto IL_1A6;
                                        }
                                        num2 = angleDelta;
                                    }
                                    else
                                    {
                                        bool flag7 = distance > num;
                                        if (flag7)
                                        {
                                            goto IL_1A6;
                                        }
                                    }
                                    Vector3 vector;
                                    bool    raycast = SphereUtilities.GetRaycast(gameObject, position, out vector);
                                    if (raycast)
                                    {
                                        Object = gameObject;
                                        num    = distance;
                                        Point  = vector;
                                    }
                                }
                            }
                        }
                    }
                }
                IL_1A6 :;
            }
            return(Object != null);
        }
Exemplo n.º 5
0
        // Token: 0x060000AC RID: 172 RVA: 0x00007CA0 File Offset: 0x00005EA0
        public static double GetAngleDelta(Vector3 mainPos, Vector3 forward, Vector3 target)
        {
            Vector3 lhs = VectorUtilities.Normalize(target - mainPos);

            return(System.Math.Atan2(VectorUtilities.GetMagnitude(Vector3.Cross(lhs, forward)), (double)Vector3.Dot(lhs, forward)) * 57.295779513082323);
        }
Exemplo n.º 6
0
 // Token: 0x060000AB RID: 171 RVA: 0x00007C80 File Offset: 0x00005E80
 public static Vector3 Normalize(Vector3 vector)
 {
     return(vector / (float)VectorUtilities.GetMagnitude(vector));
 }
Exemplo n.º 7
0
 // Token: 0x060000A8 RID: 168 RVA: 0x00007B94 File Offset: 0x00005D94
 public static double GetDistance(Vector3 point)
 {
     return(VectorUtilities.GetDistance(OptimizationVariables.MainCam.transform.position, point));
 }