Exemplo n.º 1
0
        public static void DrawSkelton(AActor player, Vector2 screenSize, Color color)
        {
            if (!PlayerBonesESP)
            {
                return;
            }
            Vector2[][] bones = GetBonesLocations(player, screenSize);

            Vector2 prev, current;

            for (int ii = 0; ii < bones.Length; ii++)
            {
                prev    = new Vector2(0, 0);
                current = new Vector2(0, 0);
                for (int j = 0; j < bones[ii].Length; j++)
                {
                    if (prev.X == 0 && prev.Y == 0)
                    {
                        prev = bones[ii][j];
                        continue;
                    }
                    current = bones[ii][j];
                    //   renderer.DrawText(j + " " + ii, current, 12, color);
                    DrawFactory.DrawLine(prev.X, prev.Y, current.X, current.Y, 2, color);
                    prev = current;
                }
            }
        }
Exemplo n.º 2
0
        public static void EvaluateTarget(AActor actor)
        {
            // if (!IsVisiable(actor))
            //      return;
            if (actor.Health < 1f)
            {
                return;
            }

            Vector2 centerScreen      = new Vector2(screensize.X / 2, screensize.Y / 2);
            Vector3 vecLocalPlayer    = Main.cameraManager.CameraCache.POV.Location;
            Vector3 vecTargetPlayer   = actor.GetBoneLocation((int)aimPos);
            Vector2 vecTargetPlayer2d = Main.cameraManager.WorldToScreen(vecTargetPlayer, screensize);


            float   BulletSpeed    = Main.localPawn.EquipWeapon().ShootWeaponEntityComp().BulletFireSpeed / 100;
            Vector3 TargetVelocity = GetPlayerVelocity(actor);
            float   curDist        = (vecTargetPlayer - vecLocalPlayer).Length();
            float   timeToTravel   = (curDist / 100) / BulletSpeed;

            if (timeToTravel > 1f && !float.IsInfinity(timeToTravel))
            {
                vecTargetPlayer   += TargetVelocity * timeToTravel;
                vecTargetPlayer.Z += TargetVelocity.Z * timeToTravel + 0.5f * 588.6f * timeToTravel * timeToTravel;
            }

            Vector2 head       = Main.cameraManager.WorldToScreen(actor.GetBoneLocation((int)aimPos), screensize);
            Vector2 prediction = Main.cameraManager.WorldToScreen(vecTargetPlayer, screensize);

            DrawFactory.DrawLine(head.X, head.Y, prediction.X, prediction.Y, 3, Color.Yellow);



            if (isInside(centerScreen.X, centerScreen.Y, 200, vecTargetPlayer2d))
            {
                if (curDist < distance)
                {
                    Rotator angDelta = ToRotator(vecLocalPlayer, vecTargetPlayer);
                    idealAngDelta = angDelta;
                    bestActor     = actor;
                    distance      = curDist;
                }
            }
        }
Exemplo n.º 3
0
        private static void DrawHealthBar(Vector2 Headw2s, float Height, float Health)
        {
            float x = Headw2s.X; float y = Headw2s.Y;
            float flBoxes = (float)Math.Ceiling(Health / 10f);
            float flX = x - 7 - Height / 4f; float flY = y - 1;
            float flHeight  = Height / 10f;
            Color ColHealth = new Color();

            Health = Math.Max(0, Math.Min(Health, 100));

            ColHealth.R = (byte)Math.Min((510 * (100 - Health)) / 100, 255);
            ColHealth.G = (byte)Math.Min((510 * Health) / 100, 255);
            ColHealth.B = 0;
            ColHealth.A = 255;

            DrawFactory.DrawBox(flX, flY, 4, Height + 2, new Color(80, 80, 80, 125));
            DrawFactory.DrawBox(flX, flY, 4, Height + 2, Color.Black);
            DrawFactory.DrawFilledBox(flX + 1, flY, 2, flHeight * flBoxes + 1, ColHealth);

            for (int i = 0; i < 10; i++)
            {
                DrawFactory.DrawLine(flX, flY + i * flHeight, flX + 4, flY + i * flHeight, 1, Color.Black);
            }
        }
Exemplo n.º 4
0
        public static void DrawBox3d(AActor player, Vector2 screenSize, Color color)
        {
            SceneComponent RootComponent = player.RootComponent();
            Vector3        loclLocation  = Main.localPawn.RootComponent().RelativeLocation;
            Vector3        enimeLocation = RootComponent.RelativeLocation;
            float          distince      = Vector3.Distance(loclLocation, enimeLocation);


            Vector3 Head = player.GetBoneLocation(6);

            Head.Z += 50;
            Vector2 Heads2s = WorldToScreen(Head, screenSize);



            float l, w, h, o;

            l = 80f; o = 50f; //box size for standing player
            h = Vector3.Distance(player.GetBoneLocation(0), Head);
            w = h / 2;        //Vector3.Distance(player.GetBoneLocation(63), player.GetBoneLocation(64));


            float zOffset = -100f;

            //if (actor.Type == ActorTypes.Vehicle) //vehicles have a bigger box
            //{
            //	zOffset = 50;
            //	l = 200f; w = 160f; h = 80f; o = 0f;
            //}

            //build box
            Vector3 p00 = new Vector3(o, -w / 2, 0f);
            Vector3 p01 = new Vector3(o, w / 2, 0f);
            Vector3 p02 = new Vector3(o - l, w / 2, 0f);
            Vector3 p03 = new Vector3(o - l, -w / 2, 0f);

            //rotate rectangle to match actor rotation
            float  theta1 = 2.0f * (float)Math.PI * (Main.cameraManager.CameraCache.POV.Rotation.Pitch) / 180.0f;
            Matrix rotM   = Matrix.RotationZ((float)(theta1 / 2)); // rotate around Z-axis

            Vector3 curPos = new Vector3(RootComponent.RelativeLocation.X, RootComponent.RelativeLocation.Y, RootComponent.RelativeLocation.Z + zOffset);

            p00 = Vector3.TransformCoordinate(p00, rotM) + curPos;
            p01 = Vector3.TransformCoordinate(p01, rotM) + curPos;
            p02 = Vector3.TransformCoordinate(p02, rotM) + curPos;
            p03 = Vector3.TransformCoordinate(p03, rotM) + curPos;

            Vector2 s00 = WorldToScreen(p00, screenSize);
            Vector2 s01 = WorldToScreen(p01, screenSize);
            Vector2 s02 = WorldToScreen(p02, screenSize);
            Vector2 s03 = WorldToScreen(p03, screenSize);

            Vector2[] square0 = { s00, s01, s02, s03, s00 };

            for (int x = 0; x < square0.Length - 1; x++)
            {
                DrawFactory.DrawLine(square0[x].X, square0[x].Y, square0[x + 1].X, square0[x + 1].Y, 2, color);
            }


            // top rectangle
            p00.Z += h; s00 = WorldToScreen(p00, screenSize);
            p01.Z += h; s01 = WorldToScreen(p01, screenSize);
            p02.Z += h; s02 = WorldToScreen(p02, screenSize);
            p03.Z += h; s03 = WorldToScreen(p03, screenSize);

            Vector2[] square1 = { s00, s01, s02, s03, s00 };
            for (int x = 0; x < square1.Length - 1; x++)
            {
                DrawFactory.DrawLine(square1[x].X, square1[x].Y, square1[x + 1].X, square1[x + 1].Y, 2, color);
            }


            // upper/lower rectangles get connected
            DrawFactory.DrawLine(square0[0].X, square0[0].Y, square1[0].X, square1[0].Y, 2, color);
            DrawFactory.DrawLine(square0[1].X, square0[1].Y, square1[1].X, square1[1].Y, 2, color);
            DrawFactory.DrawLine(square0[2].X, square0[2].Y, square1[2].X, square1[2].Y, 2, color);
            DrawFactory.DrawLine(square0[3].X, square0[3].Y, square1[3].X, square1[3].Y, 2, color);
        }