示例#1
0
        private void DrawBoxes(Player player)
        {
            D.boneList = player.PlayerBody.SkeletonRootJoint.Bones.Values.ToList();
            if (D.boneList.Count == 0)
            {
                return;
            }
            D.vectorA = D.boneList[0].position;
            D.vectorB = D.vectorA;
            D.boneList.RemoveAt(0);
            D.vectorC = Vector3.zero;
            for (int i = 0; i < D.boneList.Count; i++)
            {
                Transform bone = D.boneList[i];
                if (bone == null || !neededBones.Contains((EHumanBones)i))
                {
                    continue;
                }
                D.vectorC = bone.position;
                if (D.vectorA.x > D.vectorC.x)
                {
                    D.vectorA.x = D.vectorC.x;
                }
                if (D.vectorA.y > D.vectorC.y)
                {
                    D.vectorA.y = D.vectorC.y;
                }
                if (D.vectorA.z > D.vectorC.z)
                {
                    D.vectorA.z = D.vectorC.z;
                }

                if (D.vectorB.x < D.vectorC.x)
                {
                    D.vectorB.x = D.vectorC.x;
                }
                if (D.vectorB.y < D.vectorC.y)
                {
                    D.vectorB.y = D.vectorC.y;
                }
                if (D.vectorB.z < D.vectorC.z)
                {
                    D.vectorB.z = D.vectorC.z;
                }
            }
            D.bounds = new Vector3[8]
            {
                //Lower parts
                new Vector3(D.vectorA.x, D.vectorA.y, D.vectorA.z), //LB
                new Vector3(D.vectorB.x, D.vectorA.y, D.vectorA.z), //RB
                new Vector3(D.vectorA.x, D.vectorA.y, D.vectorB.z), //LF
                new Vector3(D.vectorB.x, D.vectorA.y, D.vectorB.z), //RF
                //Upper parts
                new Vector3(D.vectorA.x, D.vectorB.y, D.vectorA.z), //LB
                new Vector3(D.vectorB.x, D.vectorB.y, D.vectorA.z), //RB
                new Vector3(D.vectorA.x, D.vectorB.y, D.vectorB.z), //LF
                new Vector3(D.vectorB.x, D.vectorB.y, D.vectorB.z), //RF
            };
            D.w2sl = new Vector3[8];
            for (int i = 0; i < 8; i++)
            {
                D.w2sl[i]   = CGameWorld.MainCamera.WorldToScreenPoint(D.bounds[i]);
                D.w2sl[i].y = NamelessScreen.screenHeight - D.w2sl[i].y;
            }
            if (Settings.CPlayer.bDraw2DBox)
            {
                //Draw2DBox

                D.vectorA = D.w2sl[0];
                D.vectorB = D.vectorA;
                for (int i = 1; i < 8; i++)
                {
                    if (D.w2sl[i].z < 0.01f)
                    {
                        continue;
                    }
                    if (D.vectorA.x > D.w2sl[i].x)
                    {
                        D.vectorA.x = D.w2sl[i].x;
                    }
                    if (D.vectorA.y > D.w2sl[i].y)
                    {
                        D.vectorA.y = D.w2sl[i].y;
                    }
                    if (D.vectorB.x < D.w2sl[i].x)
                    {
                        D.vectorB.x = D.w2sl[i].x;
                    }
                    if (D.vectorB.y < D.w2sl[i].y)
                    {
                        D.vectorB.y = D.w2sl[i].y;
                    }
                }
                D.box2D = new Vector2[4]
                {
                    new Vector3(D.vectorA.x, D.vectorA.y),
                    new Vector3(D.vectorB.x, D.vectorA.y),
                    new Vector3(D.vectorA.x, D.vectorB.y),
                    new Vector3(D.vectorB.x, D.vectorB.y)
                };
                Print.DrawLine(D.box2D[0], D.box2D[1], 2f, Settings.CPlayer.BoxColor);
                Print.DrawLine(D.box2D[0], D.box2D[2], 2f, Settings.CPlayer.BoxColor);
                Print.DrawLine(D.box2D[2], D.box2D[3], 2f, Settings.CPlayer.BoxColor);
                Print.DrawLine(D.box2D[3], D.box2D[1], 2f, Settings.CPlayer.BoxColor);
            }
        }
示例#2
0
        public void OnGUI()
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }

            if (!CGameWorld.IsPlaying || !Settings.CPlayer.bDraw)
            {
                return;
            }
            try
            {
                foreach (Player player in Players)
                {
                    if (!player)
                    {
                        continue;
                    }
                    D.w2s = CGameWorld.MainCamera.WorldToScreenPoint(player.Transform.position);
                    if (D.w2s.z < 0.01f)
                    {
                        continue;
                    }
                    D.w2s.y = NamelessScreen.screenHeight - D.w2s.y;
                    if (Settings.CPlayer.MaxInfoDistance < PlayersDis[player])
                    {
                        continue;
                    }
                    if (Settings.CPlayer.bDrawInformation)
                    {
                        if (PlayersBot[player] && player.Profile.Info.Settings.IsBoss())
                        {
                            Print.DrawFont(new Vector2(D.w2s.x, D.w2s.y), $"BOSS - {PlayersName[player]}[{PlayersDis[player]}]m \n {PlayersGun[player]}", Settings.CPlayer.bossColor);
                        }
                        else if (PlayersBot[player])
                        {
                            Print.DrawFont(new Vector2(D.w2s.x, D.w2s.y), $"{PlayersName[player]}[{PlayersDis[player]}m] <{PlayersWorth[player]}k> \n {PlayersGun[player]}", Settings.CPlayer.botColor);
                        }
                        else
                        {
                            Print.DrawFont(new Vector2(D.w2s.x, D.w2s.y), $"{PlayersName[player]}[{PlayersDis[player]}m] <{PlayersWorth[player]}k> \n {PlayersGun[player]} : {player.Profile.Info.Level}", Settings.CPlayer.playerColor);
                        }
                    }
                    if (Settings.CPlayer.bDrawLines && PlayersDis[player] < Settings.CPlayer.MaxInfoDistance)
                    {
                        DrawLine(player, vec2DrawLine);
                    }
                    if ((Settings.CPlayer.bDraw2DBox || Settings.CPlayer.bDrawSkeleton) && PlayersDis[player] < Settings.CPlayer.MaxDrawDistance)
                    {
                        playerBones = GetBones(player);
                        if (playerBones.Count != 0)
                        {
                            if (Settings.CPlayer.bDraw2DBox)
                            {
                                DrawBoxes(player);
                            }
                            if (Settings.CPlayer.bDrawSkeleton)
                            {
                                DrawSkeleton(playerBones);
                            }
                        }
                    }
                }
            }
            catch { }
        }