Esempio n. 1
0
    /// <summary>
    /// 取消高亮
    /// </summary>
    public virtual void HighLightOff()
    {
        Highlighter h = gameObject.AddMissingComponent <Highlighter>();

        //SetOcculuderState(true);
        h.ConstantOffImmediate();
    }
Esempio n. 2
0
        /// <summary>
        /// 关闭高亮
        /// </summary>
        public void HideHighLight()
        {
            var highlights = highLightTransform.GetComponentsInChildren <HighlightObject>().Where(obj => obj != this);

            switch (highlightType)
            {
            case HighLightType.Model:
                if (highlightModel != null && highlightModel.activeSelf == true)
                {
                    highlightModel.SetActive(false);
                }

                //显示子物体下的所有高亮
                foreach (var item in highlights)
                {
                    if (item.highlightModel != null && item.highlightModel.activeSelf)
                    {
                        item.highlightModel.SetActive(false);
                    }
                }

                break;

            case HighLightType.Shader:
                h.ConstantOffImmediate();
                break;

            default:
                break;
            }
        }
Esempio n. 3
0
    public void reset()
    {
        print("In TransformManager.reset() ...");
        mode = Mode.None;
        if (selectedGO != null)
        {
            Highlighter highlighter = selectedGO.GetComponent <Highlighter>();
            if (highlighter != null)
            {
                highlighter.ConstantOffImmediate();
                print("TransformsManager.reset() ... Disabled highlighter for selected GameObject = " + selectedGO.name);
            }
            TransformControl transformControl = selectedGO.GetComponent <TransformControl>();
            if (transformControl != null)
            {
                transformControl.mode = TransformControl.TransformMode.None;
                print("TransformManager.reset() ...  Set TransformControl component to TransformMode.None for GameObject = " + selectedGO);
            }
        }

        if (selectionManager != null)
        {
            selectionManager.enabled = true;
        }
        Debug.Log("Reset clicked");
    }
Esempio n. 4
0
        public void HideStepHighLighting(PBKeyFrame curKeyFrame)
        {
            if (!mIsShowStepHighlight || curKeyFrame == null)
            {
                return;
            }
            foreach (PBKeyFrameItem item in curKeyFrame.KeyFrameItems)
            {
                if (item.PosNotChange || item.Target.name == "section_0")
                {
                    continue;
                }

                PBBlock[] blocks = item.Target.GetComponentsInChildren <PBBlock>();
                for (int i = 0; i < blocks.Length; ++i)
                {
                    if (blocks[i].hide)
                    {
                        continue;
                    }
                    Highlighter high = blocks[i].gameObject.AddSingleComponent <Highlighter>();
                    high.ConstantOffImmediate();
                }
            }
        }
Esempio n. 5
0
 // Token: 0x06000006 RID: 6 RVA: 0x00002810 File Offset: 0x00000A10
 public static void ToggleGlowPlayers()
 {
     EspMenu.PlayersGlow = !EspMenu.PlayersGlow;
     foreach (Player player in FindObjectsOfType <Player>())
     {
         if (!(Player.player.name == player.name))
         {
             Highlighter highlighter = player.gameObject.GetComponent <Highlighter>();
             if (!EspMenu.PlayersGlow)
             {
                 highlighter.ConstantOffImmediate();
             }
             else
             {
                 if (highlighter == null)
                 {
                     highlighter = player.gameObject.AddComponent <Highlighter>();
                 }
                 highlighter.ConstantParams(Color.red);
                 highlighter.OccluderOn();
                 highlighter.SeeThroughOn();
                 highlighter.ConstantOn();
             }
         }
     }
 }
Esempio n. 6
0
 public void SetHL(bool b)
 {
     if (b)
     {
         h.ConstantOnImmediate(hoverColor);
     }
     else
     {
         h.ConstantOffImmediate();
     }
 }
    public static void RemoveHighlight(Highlighter h)
    {
        bool flag = h == null;

        if (!flag)
        {
            h.occluder = false;
            h.overlay  = false;
            h.ConstantOffImmediate();
        }
    }
        // Token: 0x060001F4 RID: 500 RVA: 0x00012C98 File Offset: 0x00010E98
        private static void RemoveHighlight(Highlighter h)
        {
            bool flag  = h == null;
            bool flag2 = !flag;

            if (flag2)
            {
                h.occluder = false;
                h.overlay  = false;
                h.ConstantOffImmediate();
            }
        }
Esempio n. 9
0
 private void unHighlight(GameObject go)
 {
     print("SelectionManager.unHighlight() ... In unHighlight() ... ");
     if (go != null)
     {
         print("SelectionManager.unHighlight() ... go.name = " + go.name);
         Highlighter highlighter = go.GetComponent <Highlighter>();
         if (highlighter != null)
         {
             highlighter.ConstantOffImmediate();
             print("SelectionManager.unHighlight() ... Highlight removed from gameObject = " + go.name);
         }
     }
 }
Esempio n. 10
0
        /// <summary>
        /// 关闭虚影
        /// </summary>
        public void CloseGhost()
        {
            if (_traShadowNode != null)
            {
                highlighter?.ConstantOffImmediate();
                if (_traShadowNode.gameObject.activeSelf)
                {
                    _traShadowNode.gameObject.SetActive(false);
                }

                _traShadowNode.SetParent(this.node);
                _traShadowNode.transform.localPosition = Vector3.zero;
                _traShadowNode.transform.localRotation = Quaternion.identity;
                _traShadowNode.transform.localScale    = Vector3.one;
            }
        }
Esempio n. 11
0
 public void setLooping(bool val)
 {
     m_looping = val;
     if (IAAPlayer.localPlayer == null)
     {
         return;
     }
     if (m_looping)
     {
         m_highlight.ConstantOnImmediate(HighlightColour);
         IAAPlayer.localPlayer.CmdSoundObjectStartSequencer(netId);
     }
     else
     {
         m_highlight.ConstantOffImmediate();
         IAAPlayer.localPlayer.CmdSoundObjectStopSequencer(netId);
     }
 }
Esempio n. 12
0
        //
        void Update()
        {
            float time = Time.time;

            if (time >= start + delay)
            {
                state = !state;
                start = time;
                delay = Random.Range(delayMin, delayMax);

                if (state)
                {
                    Color color = Highlighter.HSVToRGB(Random.value, 1f, 1f);
                    highlighter.ConstantOnImmediate(color);
                }
                else
                {
                    highlighter.ConstantOffImmediate();
                }
            }
        }
Esempio n. 13
0
    /// <summary>
    /// API:修改物体是否开启高亮
    /// </summary>
    /// <param name="showHightlight">是否开启高亮</param>
    /// <param name="type">高亮类型</param>
    public void SwithHightlight(bool showHightlight, HighlightType type)
    {
        switch (type)
        {
        case HighlightType.Once:
            if (showHightlight)
            {
                h.ConstantOnImmediate(highlightColor);
            }
            else
            {
                h.ConstantOffImmediate();
            }
            break;

        case HighlightType.Constant:
            if (showHightlight)
            {
                h.ConstantOn(highlightColor);
            }
            else
            {
                h.ConstantOff();
            }
            break;

        case HighlightType.Flash:
            if (showHightlight)
            {
                h.FlashingOn(highlightColor, new Color(0, 0, 0, 0));
            }
            else
            {
                h.TweenStop();
            }
            break;
        }
    }
Esempio n. 14
0
 // Token: 0x06000007 RID: 7 RVA: 0x000028A8 File Offset: 0x00000AA8
 public static void ToggleGlowZombies()
 {
     EspMenu.ZombieGlow = !EspMenu.ZombieGlow;
     foreach (Zombie zombie in FindObjectsOfType <Zombie>())
     {
         Highlighter highlighter = zombie.gameObject.GetComponent <Highlighter>();
         if (!EspMenu.ZombieGlow)
         {
             highlighter.ConstantOffImmediate();
         }
         else
         {
             if (highlighter == null)
             {
                 highlighter = zombie.gameObject.AddComponent <Highlighter>();
             }
             highlighter.ConstantParams(Color.blue);
             highlighter.OccluderOn();
             highlighter.SeeThroughOn();
             highlighter.ConstantOn();
         }
     }
 }
Esempio n. 15
0
        void OnGUI()
        {
            if (!Provider.isConnected || Provider.isLoading || (PlayerCam.IsFullScreen && PlayerCam.player != null))
            {
                return;
            }
            #region Item Clump Boxes
            if (G.Settings.ItemOptions.Enabled && G.Settings.GlobalOptions.ListClumpedItems && !G.BeingSpied)
            {
                for (int i = 0; i < ItemClumps.Count; i++)
                {
                    ItemClumpObject itemClumpObject = ItemClumps[i];

                    Vector3 pos = G.MainCamera.WorldToScreenPoint(itemClumpObject.WorldPos);
                    pos.y = Screen.height - pos.y;
                    if (pos.z >= 0 && (Vector3.Distance(Player.player.transform.position, itemClumpObject.WorldPos) <= G.Settings.ItemOptions.MaxDistance))
                    {
                        string s = "";
                        foreach (InteractableItem item in itemClumpObject.ClumpedItems)
                        {
                            Color   c1 = ItemTool.getRarityColorHighlight(item.asset.rarity);
                            Color32 c  = new Color32((byte)(c1.r * 255), (byte)(c1.g * 255), (byte)(c1.b * 255), 255);
                            s += $"<color=#{Colors.ColorToHex(c)}>{item.asset.itemName}</color>\n";
                        }
                        Vector2 TextHeight = GUIStyle.none.CalcSize(new GUIContent($"<size=10>{s}</size>"));
                        GUILayout.BeginArea(new Rect(pos.x, pos.y, TextHeight.x + 10, TextHeight.y), style: "box");
                        GUILayout.Label($"<size=10>{s}</size>");
                        GUILayout.EndArea();
                    }
                }
            }
            GUI.skin = null;
            #endregion
            for (int i = 0; i < EObjects.Count; i++)
            {
                ESPObj obj = EObjects[i];
                #region Checks
                if (obj.GObject != null && (!obj.Options.Enabled || T.GetDistance(obj.GObject.transform.position) > obj.Options.MaxDistance || (obj.Target == ESPObject.Item && (!T.IsItemWhitelisted((InteractableItem)obj.Object, G.Settings.MiscOptions.ESPWhitelist) || Items.IsAlreadyClumped((InteractableItem)obj.Object)))))
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>();
                    if (h != null)
                    {
                        h.ConstantOffImmediate();
                    }
                }

                if (obj.GObject == null || !T.InScreenView(G.MainCamera.WorldToViewportPoint(obj.GObject.transform.position)) || !obj.Options.Enabled || T.GetDistance(obj.GObject.transform.position) > obj.Options.MaxDistance)
                {
                    continue;
                }
                if (G.BeingSpied)
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>();
                    if (h != null)
                    {
                        h.ConstantOffImmediate();
                    }
                    T.RemoveShaders(obj.GObject);
                    continue;
                }
                if (obj.Target == ESPObject.Player && ((SteamPlayer)obj.Object).player.life.isDead)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Zombie && ((Zombie)obj.Object).isDead)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Vehicle && ((InteractableVehicle)obj.Object).isDead)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Vehicle && G.Settings.GlobalOptions.OnlyUnlocked && ((InteractableVehicle)obj.Object).isLocked)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Bed && G.Settings.GlobalOptions.OnlyUnclaimed && ((InteractableBed)obj.Object).isClaimed)
                {
                    continue;
                }
                if (obj.Target == ESPObject.Item && !T.IsItemWhitelisted((InteractableItem)obj.Object, G.Settings.MiscOptions.ESPWhitelist))
                {
                    continue;
                }
                if (obj.Target == ESPObject.Item && G.Settings.GlobalOptions.ListClumpedItems && Items.IsAlreadyClumped((InteractableItem)obj.Object))
                {
                    continue;
                }

                if (G.BeingSpied)
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>();
                    if (h != null)
                    {
                        h.ConstantOffImmediate();
                    }
                    T.RemoveShaders(obj.GObject);
                    continue;
                }
                #endregion

                #region Globals
                string  LabelText   = $"<size={obj.Options.FontSize}>";
                string  OutlineText = $"<size={obj.Options.FontSize}>";
                Color32 color       = Colors.GetColor(Enum.GetName(typeof(ESPObject), obj.Target) + "_ESP");
                if (obj.Options.Distance)
                {
                    LabelText   += $"<color=white>[{T.GetDistance(obj.GObject.transform.position)}]</color> ";
                    OutlineText += $"[{T.GetDistance(obj.GObject.transform.position)}] ";
                }
                #endregion

                #region Label Shit
                switch (obj.Target)
                {
                case ESPObject.Player:
                    Player player = ((SteamPlayer)obj.Object).player;
                    switch (T.GetPriority(((SteamPlayer)obj.Object).playerID.steamID.m_SteamID))
                    {
                    case Priority.Friendly:
                        color = Colors.GetColor("Friendly_Player_ESP");
                        break;

                    case Priority.Marked:
                        color = Colors.GetColor("Marked_Player_ESP");
                        break;
                    }

                    if (obj.Options.Name)
                    {
                        LabelText   += ((SteamPlayer)obj.Object).playerID.characterName;
                        OutlineText += ((SteamPlayer)obj.Object).playerID.characterName;
                    }
                    if (G.Settings.GlobalOptions.Weapon)
                    {
                        string Weapon = player.equipment.asset != null ? ((SteamPlayer)obj.Object).player.equipment.asset.itemName : "None";
                        LabelText   += $"<color=white> - {Weapon}</color>";
                        OutlineText += " - " + Weapon;
                    }
                    if (G.Settings.GlobalOptions.ViewHitboxes && G.Settings.AimbotOptions.ExpandHitboxes && G.Settings.AimbotOptions.SilentAim)
                    {
                        Player  p         = ((SteamPlayer)obj.Object).player;
                        Vector3 W2SPlayer = T.WorldToScreen(player.transform.position);
                        if (W2SPlayer.z >= 0)
                        {
                            Vector3 W2SOffset = T.WorldToScreen(new Vector3(player.transform.position.x, player.transform.position.y + G.Settings.AimbotOptions.HitboxSize, player.transform.position.z));
                            float   Distance  = Vector3.Distance(W2SPlayer, W2SOffset);
                            T.DrawCircle(Colors.GetColor("Extended_Hitbox_Circle"), new Vector2(W2SPlayer.x, W2SPlayer.y), Distance);
                        }
                    }
                    break;

                case ESPObject.Item:
                    if (obj.Options.Name)
                    {
                        LabelText   += ((InteractableItem)obj.Object).asset.itemName;
                        OutlineText += ((InteractableItem)obj.Object).asset.itemName;
                    }
                    break;

                case ESPObject.Vehicle:
                    if (obj.Options.Name)
                    {
                        LabelText   += ((InteractableVehicle)obj.Object).asset.vehicleName;
                        OutlineText += ((InteractableVehicle)obj.Object).asset.vehicleName;
                    }
                    if (G.Settings.GlobalOptions.VehicleLocked)
                    {
                        if (((InteractableVehicle)obj.Object).isLocked)
                        {
                            LabelText   += $"<color=white> - Locked</color>";
                            OutlineText += " - Locked";
                        }
                        else
                        {
                            LabelText   += $"<color=white> - </color><color=ff5a00>Unlocked</color>";
                            OutlineText += " - Unlocked";
                        }
                    }
                    break;

                case ESPObject.Bed:
                    if (obj.Options.Name)
                    {
                        LabelText   += Enum.GetName(typeof(ESPObject), obj.Target);
                        OutlineText += Enum.GetName(typeof(ESPObject), obj.Target);
                    }
                    if (G.Settings.GlobalOptions.Claimed)
                    {
                        if (((InteractableBed)obj.Object).isClaimed)
                        {
                            LabelText   += $"<color=white> - Claimed</color>";
                            OutlineText += " - Claimed";
                        }
                        else
                        {
                            LabelText   += $"<color=white> - </color><color=ff5a00>Unclaimed</color>";
                            OutlineText += " - Unclaimed";
                        }
                    }
                    break;

                case ESPObject.Storage:

                    BarricadeData bdata = null;
                    if (obj.Options.Name || G.Settings.GlobalOptions.ShowLocked)
                    {
                        try
                        {
                            BarricadeRegion r;
                            if (BarricadeManager.tryGetInfo(((InteractableStorage)obj.Object).transform, out byte x, out byte y, out ushort plant, out ushort index, out r))
                            {
                                bdata = r.barricades[index];
                            }
                        }
                        catch (Exception ex)
                        {
                            Debug.Log(ex);
                        }
                    }

                    if (obj.Options.Name)
                    {
                        string s = "Storage";
                        if (bdata != null)
                        {
                            s = bdata.barricade.asset.name.Replace("_", " ");
                        }

                        LabelText   += s;
                        OutlineText += s;
                    }

                    if (G.Settings.GlobalOptions.ShowLocked)
                    {
                        if (bdata != null)
                        {
                            if (bdata.barricade.asset.isLocked)
                            {
                                LabelText   += $"<color=white> - Locked</color>";
                                OutlineText += " - Locked";
                            }
                            else
                            {
                                LabelText   += $"<color=white> - </color><color=ff5a00>Unlocked</color>";
                                OutlineText += " - Unlocked";
                            }
                        }
                        else
                        {
                            LabelText   += $"<color=white> - Unknown</color>";
                            OutlineText += " - Unknown";
                        }
                    }
                    break;

                default:
                    if (obj.Options.Name)
                    {
                        LabelText   += Enum.GetName(typeof(ESPObject), obj.Target);
                        OutlineText += Enum.GetName(typeof(ESPObject), obj.Target);
                    }
                    break;
                }
                #endregion

                #region Draw
                LabelText   += "</size>";
                OutlineText += "</size>";

                if (obj.Options.Tracers)
                {
                    T.DrawSnapline(obj.GObject.transform.position, color);
                }
                if (!String.IsNullOrEmpty(LabelText))
                {
                    T.DrawESPLabel(obj.GObject.transform.position, color, Color.black, LabelText, OutlineText);
                }
                if (obj.Options.Box)
                {
                    if (obj.Target == ESPObject.Player)
                    {
                        Vector3 p = obj.GObject.transform.position;
                        Vector3 s = obj.GObject.transform.localScale;
                        if (p != null & s != null)
                        {
                            T.Draw3DBox(new Bounds(p + new Vector3(0, 1.1f, 0), s + new Vector3(0, .95f, 0)), color);
                        }
                    }
                    else
                    {
                        T.Draw3DBox(obj.GObject.GetComponent <Collider>().bounds, color);
                    }
                }
                if (obj.Options.Glow)
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>() ?? obj.GObject.AddComponent <Highlighter>();
                    h.occluder = true;
                    h.overlay  = true;
                    h.ConstantOnImmediate(color);
                }
                else
                {
                    Highlighter h = obj.GObject.GetComponent <Highlighter>();
                    if (h != null)
                    {
                        h.ConstantOffImmediate();
                    }
                }
                #endregion
            }
            // sometimes shows localplayer glowing after your car explodes
            Highlighter hi = Player.player?.gameObject?.GetComponent <Highlighter>();
            if (hi != null)
            {
                hi.ConstantOffImmediate();
            }
        }
Esempio n. 16
0
 public void HighlightOff()
 {
     UpdateHighlighter();
     h.ConstantOffImmediate();
 }
Esempio n. 17
0
        public static void DoGlow()
        {
            foreach (SteamPlayer play in Provider.clients)
            {
                if (play.player == Player.player)
                {
                    continue;
                }

                Highlighter Highlighter = play.player.gameObject.GetComponent <Highlighter>();

                if ((Global.VisualsEnabled && Global.VisSettings.Glow) && !Global.AllOff && !Hooks.askScreenshot.NeedingSpy)
                {
                    if (Highlighter == null)
                    {
                        Highlighter = play.player.gameObject.AddComponent <Highlighter>();
                    }

                    //Deprecated, http://docs.deepdream.games/HighlightingSystem/5.0/#toc9.1upgrading_from_v4.3_to_v5.0
                    //Highlighter.SeeThroughOn();
                    //Highlighter.OccluderOn();

                    //Color blue if in group
                    if (play.player.quests.groupID == Player.player.quests.groupID)
                    {
                        Highlighter.ConstantOnImmediate(Color.blue);
                    }
                    else
                    {
                        Highlighter.ConstantOnImmediate(Color.yellow);
                    }
                }
                else if (Highlighter != null)
                {
                    Highlighter.ConstantOffImmediate();
                    MonoBehaviour.Destroy(Highlighter);
                }
            }

            if (Global.VisSettings.Items)
            {
                foreach (ItemRegion region in ItemManager.regions)
                {
                    foreach (ItemDrop drop in region.drops)
                    {
                        if (drop.interactableItem.asset is ItemGunAsset)
                        {
                            EItemRarity rar = ((ItemGunAsset)drop.interactableItem.asset).rarity;
                            if (rar == EItemRarity.COMMON || rar == EItemRarity.UNCOMMON || rar == EItemRarity.RARE)
                            {
                                continue;
                            }

                            Highlighter Highlighter = drop.interactableItem.gameObject.GetComponent <Highlighter>();

                            if (Global.VisualsEnabled && Global.VisSettings.Glow && !Global.AllOff && !Hooks.askScreenshot.NeedingSpy)
                            {
                                if (Highlighter == null)
                                {
                                    Highlighter = drop.interactableItem.gameObject.AddComponent <Highlighter>();
                                }

                                Highlighter.ConstantOnImmediate(Color.white);
                            }
                            else if (Highlighter != null)
                            {
                                Highlighter.ConstantOffImmediate();
                                MonoBehaviour.Destroy(Highlighter);
                            }
                        }
                    }
                }
            }

            if (Hooks.askScreenshot.NeedingSpy)
            {
                System.Threading.Thread.Sleep(85);
                Hooks.askScreenshot.GlowReady = true;
            }
        }
Esempio n. 18
0
 public void HighlightOff()
 {
     h.ConstantOffImmediate();
 }
Esempio n. 19
0
        public void OnGUI()
        {
            if (Event.current.type != EventType.Repaint || !ESPOptions.Enabled)
                return;

            if (!DrawUtilities.ShouldRun())
                return;

            GUI.depth = 1;

            if (MainCamera == null)
                MainCamera = OptimizationVariables.MainCam;

            Vector3 localPos = OptimizationVariables.MainPlayer.transform.position;

            Vector3 aimPos = OptimizationVariables.MainPlayer.look.aim.position;
            Vector3 aimForward = OptimizationVariables.MainPlayer.look.aim.forward;

            for (int i = 0; i < ESPVariables.Objects.Count; i++)
            {
                ESPObject obj = ESPVariables.Objects[i];
                ESPVisual visual = ESPOptions.VisualOptions[(int)obj.Target];

                GameObject go = obj.GObject;

                if (!visual.Enabled)
                {
                    Highlighter highlighter = go.GetComponent<Highlighter>();
                    if (highlighter != null && highlighter != TrajectoryComponent.Highlighted)
                        highlighter.ConstantOffImmediate();

                    continue;
                }
                if (obj.Target == ESPTarget.Items && ESPOptions.FilterItems)
                    if (!ItemUtilities.Whitelisted(((InteractableItem)obj.Object).asset, ItemOptions.ItemESPOptions))
                        continue;

                Color c = ColorUtilities.getColor($"_{obj.Target}");
                LabelLocation ll = visual.Location;

                if (go == null)
                    continue;

                Vector3 position = go.transform.position;
                double dist = VectorUtilities.GetDistance(position, localPos);

                if (dist < 0.5 || (dist > visual.Distance && !visual.InfiniteDistance))
                    continue;

                Vector3 cpos = MainCamera.WorldToScreenPoint(position);

                if (cpos.z <= 0)
                    continue;

                string text = "";

                Vector3 scale = go.transform.localScale;
                Bounds b;
                switch (obj.Target)
                {
                    case ESPTarget.Players:
                    case ESPTarget.Zombies:
                        b = new Bounds(new Vector3(position.x, position.y + 1, position.z),
                            new Vector3(scale.x * 2, scale.y * 3, scale.z * 2));
                        break;
                    case ESPTarget.Vehicles:

                        b = go.transform.Find("Model_0").GetComponent<MeshRenderer>().bounds;
                        Transform child = go.transform.Find("Model_1");

                        if (child != null)
                            b.Encapsulate(child.GetComponent<MeshRenderer>().bounds);

                        break;
                    default:
                        b = go.GetComponent<Collider>().bounds;
                        break;
                }

                int size = DrawUtilities.GetTextSize(visual, dist);
                double rounded = Math.Round(dist);

                /*#if DEBUG
				DebugUtilities.Log(obj.Target.ToString()); //Holy f**k nuggets this is laggy
				#endif*/

                string outerText = $"<size={size}>";
                text = $"<size={size}>";

                switch (obj.Target)
                {
                    #region Players

                    case ESPTarget.Players:
                        {
                            Player p = (Player)obj.Object;

                            if (p.life.isDead)
                                continue;

                            if (visual.ShowName)
                                text += GetSteamPlayer(p).playerID.characterName + "\n";
                            if (RaycastUtilities.TargetedPlayer == p && RaycastOptions.EnablePlayerSelection)
                                text += "[Targeted]\n";
                            if (ESPOptions.ShowPlayerWeapon)
                                text += (p.equipment.asset != null ? p.equipment.asset.itemName : "Fists") + "\n";
                            if (ESPOptions.ShowPlayerVehicle)
                                text += (p.movement.getVehicle() != null ? p.movement.getVehicle().asset.name + "\n" : "No Vehicle\n");
                            b.size = b.size / 2;
                            b.size = new Vector3(b.size.x, b.size.y * 1.25f, b.size.z);

                            if (FriendUtilities.IsFriendly(p) && ESPOptions.UsePlayerGroup)
                                c = ColorUtilities.getColor("_ESPFriendly");

                            break;
                        }

                    #endregion

                    #region Zombies

                    case ESPTarget.Zombies:
                        {
                            if (((Zombie)obj.Object).isDead)
                                continue;

                            if (visual.ShowName)
                                text += $"Zombie\n";

                            break;
                        }

                    #endregion

                    #region Items

                    case ESPTarget.Items:
                        {
                            InteractableItem item = (InteractableItem)obj.Object;

                            if (visual.ShowName)
                                text += item.asset.itemName + "\n";

                            break;
                        }

                    #endregion

                    #region Sentries

                    case ESPTarget.Sentries:
                        {
                            InteractableSentry sentry = (InteractableSentry)obj.Object;

                            if (visual.ShowName)
                            {
                                text += "Sentry\n";
                                outerText += "Sentry\n";
                            }

                            if (ESPOptions.ShowSentryItem)
                            {
                                outerText += SentryName(sentry.displayItem, false) + "\n";
                                text += SentryName(sentry.displayItem, true) + "\n";
                            }

                            break;
                        }

                    #endregion

                    #region Beds

                    case ESPTarget.Beds:
                        {
                            InteractableBed bed = (InteractableBed)obj.Object;

                            if (visual.ShowName)
                            {
                                text += "Bed\n";
                                outerText += "Bed\n";
                            }

                            if (ESPOptions.ShowClaimed)
                            {
                                text += GetOwned(bed, true) + "\n";
                                outerText += GetOwned(bed, false) + "\n";
                            }
                            break;
                        }

                    #endregion

                    #region Claim Flags

                    case ESPTarget.ClaimFlags:
                        {
                            if (visual.ShowName)
                                text += "Claim Flag\n";

                            break;
                        }

                    #endregion

                    #region Vehicles

                    case ESPTarget.Vehicles:
                        {
                            InteractableVehicle vehicle = (InteractableVehicle)obj.Object;

                            if (vehicle.health == 0)
                                continue;

                            if (ESPOptions.FilterVehicleLocked && vehicle.isLocked)
                                continue;

                            vehicle.getDisplayFuel(out ushort displayFuel, out ushort MaxFuel);

                            float health = Mathf.Round(100 * (vehicle.health / (float)vehicle.asset.health));
                            float fuel = Mathf.Round(100 * (displayFuel / (float)MaxFuel));

                            if (visual.ShowName)
                            {
                                text += vehicle.asset.name + "\n";
                                outerText += vehicle.asset.name + "\n";
                            }

                            if (ESPOptions.ShowVehicleHealth)
                            {
                                text += $"Health: {health}%\n";
                                outerText += $"Health: {health}%\n";
                            }

                            if (ESPOptions.ShowVehicleFuel)
                            {
                                text += $"Fuel: {fuel}%\n";
                                outerText += $"Fuel: {fuel}%\n";
                            }

                            if (ESPOptions.ShowVehicleLocked)
                            {
                                text += GetLocked(vehicle, true) + "\n";
                                outerText += GetLocked(vehicle, false) + "\n";
                            }

                            break;
                        }

                    #endregion

                    #region Storage

                    case ESPTarget.Storage:
                        {
                            if (visual.ShowName)
                                text += "Storage\n";

                            break;
                        }

                    #endregion

                    #region Generators

                    case ESPTarget.Generators:
                        {
                            InteractableGenerator gen = (InteractableGenerator)obj.Object;

                            float fuel = Mathf.Round(100 * (gen.fuel / (float)gen.capacity));

                            if (ESPOptions.ShowGeneratorFuel)
                            {
                                text += $"Fuel: {fuel}%\n";
                                outerText += $"Fuel: {fuel}%\n";
                            }

                            if (ESPOptions.ShowGeneratorPowered)
                            {
                                text += GetPowered(gen, true) + "\n";
                                outerText += GetPowered(gen, false) + "\n";
                            }

                            break;
                        }

                        #endregion
                }

                if (outerText == $"<size={size}>")
                    outerText = null;

                if (visual.ShowDistance)
                {
                    text += $"{rounded}m\n";

                    if (outerText != null)
                        outerText += $"{rounded}m\n";
                }

                if (visual.ShowAngle)
                {
                    double roundedFOV = Math.Round(VectorUtilities.GetAngleDelta(aimPos, aimForward, position), 2);
                    text += $"Angle: {roundedFOV}°\n";

                    if (outerText != null)
                        outerText += $"{roundedFOV}°\n";
                }

                text += "</size>";

                if (outerText != null)
                    outerText += "</size>";

                Vector3[] vectors = DrawUtilities.GetBoxVectors(b);

                Vector2[] W2SVectors = DrawUtilities.GetRectangleLines(MainCamera, b, c);
                Vector3 LabelVector = DrawUtilities.Get2DW2SVector(MainCamera, W2SVectors, ll);

                if (MirrorCameraOptions.Enabled && W2SVectors.Any(v => MirrorCameraComponent.viewport.Contains(v)))
                {
                    Highlighter highlighter = go.GetComponent<Highlighter>();
                    if (highlighter != null)
                        highlighter.ConstantOffImmediate();

                    continue;
                }

                if (visual.Boxes)
                {
                    if (visual.TwoDimensional)
                        DrawUtilities.PrepareRectangleLines(W2SVectors, c);
                    else
                    {
                        DrawUtilities.PrepareBoxLines(vectors, c);
                        LabelVector = DrawUtilities.Get3DW2SVector(MainCamera, b, ll);
                    }
                }

                if (visual.Glow)
                {
                    Highlighter highlighter = go.GetComponent<Highlighter>() ?? go.AddComponent<Highlighter>();
                    //highlighter.OccluderOn();
                    //highlighter.SeeThroughOn();

                    highlighter.occluder = true;
                    highlighter.overlay = true;
                    highlighter.ConstantOnImmediate(c);
                    Highlighters.Add(highlighter);
                }
                else
                {
                    Highlighter highlighter = go.GetComponent<Highlighter>();
                    if (highlighter != null && highlighter != TrajectoryComponent.Highlighted)
                        highlighter.ConstantOffImmediate();
                }

                if (visual.Labels)
                    DrawUtilities.DrawLabel(ESPFont, ll, LabelVector, text, visual.CustomTextColor ? ColorUtilities.getColor($"_{obj.Target}_Text") : c, ColorUtilities.getColor($"_{obj.Target}_Outline"), visual.BorderStrength, outerText);

                if (visual.LineToObject)
                    ESPVariables.DrawBuffer2.Enqueue(new ESPBox2
                    {
                        Color = c,
                        Vertices = new[]
                        {
                            new Vector2(Screen.width / 2, Screen.height),
                            new Vector2(cpos.x, Screen.height - cpos.y)
                        }
                    });
            }

            GLMat.SetPass(0);

            GL.PushMatrix();
            GL.LoadProjectionMatrix(MainCamera.projectionMatrix);
            GL.modelview = MainCamera.worldToCameraMatrix;
            GL.Begin(GL.LINES);

            for (int i = 0; i < ESPVariables.DrawBuffer.Count; i++)
            {
                ESPBox box = ESPVariables.DrawBuffer.Dequeue();
                GL.Color(box.Color);

                Vector3[] vertices = box.Vertices;
                for (int j = 0; j < vertices.Length; j++)
                    GL.Vertex(vertices[j]);

            }
            GL.End();
            GL.PopMatrix();

            GL.PushMatrix();
            GL.Begin(GL.LINES);

            for (int i = 0; i < ESPVariables.DrawBuffer2.Count; i++)
            {
                ESPBox2 box = ESPVariables.DrawBuffer2.Dequeue();

                GL.Color(box.Color);
                Vector2[] vertices = box.Vertices;

                bool Run = true;

                for (int j = 0; j < vertices.Length; j++)
                    if (j < vertices.Length - 1)
                    {
                        Vector2 v1 = vertices[j];
                        Vector2 v2 = vertices[j + 1];

                        if (Vector2.Distance(v2, v1) > Screen.width / 2)
                        {
                            Run = false;
                            break;
                        }
                    }

                if (!Run)
                    continue;

                for (int j = 0; j < vertices.Length; j++)
                    GL.Vertex3(vertices[j].x, vertices[j].y, 0);

            }
            GL.End();
            GL.PopMatrix();
        }
Esempio n. 20
0
    // Update is called once per frame
    void Update()
    {
        if (modelController.CheckButton())
        {
            transformed  = modelController.transforme;
            distance1    = modelController.distance1;
            distance2    = modelController.distance2;
            oldPosition1 = modelController.oldRemove1;
            oldPosition2 = modelController.oldRemove2;

            if (Input.GetMouseButtonDown(0))
            {
                Ray        mRay = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
                RaycastHit mHit;
                LayerMask  mask = 1 << LayerMask.NameToLayer("Sphere");
                if (Physics.Raycast(mRay, out mHit, 20f, mask.value))
                {
                    if (mHit.collider.gameObject == alphaBase)
                    {
                        h1.ConstantOn(Color.yellow);
                        h2.ConstantOffImmediate();
                        alphaBaseFlag  = true;
                        screenBaseFlag = false;
                    }
                    else if (mHit.collider.gameObject == screenBase)
                    {
                        h2.ConstantOn(Color.yellow);
                        h1.ConstantOffImmediate();
                        alphaBaseFlag  = false;
                        screenBaseFlag = true;
                    }
                }
            }
            if (Input.touchCount == 1 && Input.GetTouch(0).phase == TouchPhase.Moved)
            {
                Vector2 deltaposition = Input.GetTouch(0).deltaPosition;
                //
                Vector3 translated = Vector3.Project(deltaposition, transformed).x *Vector3.right;
                if (alphaBaseFlag && (Vector3.Distance(magnifierBase.transform.parent.gameObject.transform.position, alphaBase.transform.parent.gameObject.transform.position) < 0.42 * Model.transform.localScale.x) && (Vector3.Distance(magnifierBase.transform.parent.gameObject.transform.position, alphaBase.transform.parent.gameObject.transform.position) > 0.05 * Model.transform.localScale.x))
                {
                    var player = ClientScene.localPlayers[0].gameObject.GetComponent <Player>();
                    player.CheckAuthority(GetComponent <NetworkIdentity>(), player.GetComponent <NetworkIdentity>());
                    CmdAlphaBaseTranslate(translated);
                }
                else if (screenBaseFlag && (Vector3.Distance(magnifierBase.transform.parent.gameObject.transform.position, screenBase.transform.parent.transform.position) < 0.42 * Model.transform.localScale.x) && (Vector3.Distance(magnifierBase.transform.parent.gameObject.transform.position, screenBase.transform.parent.gameObject.transform.position) > 0.05 * Model.transform.localScale.x))
                {
                    var player = ClientScene.localPlayers[0].gameObject.GetComponent <Player>();
                    player.CheckAuthority(GetComponent <NetworkIdentity>(), player.GetComponent <NetworkIdentity>());
                    CmdScreenBaseTranslate(translated);
                }
            }
            if (alphaBaseFlag && (Vector3.Distance(magnifierBase.transform.parent.gameObject.transform.position, alphaBase.transform.parent.gameObject.transform.position) >= 0.42 * Model.transform.localScale.x))
            {
                var player = ClientScene.localPlayers[0].gameObject.GetComponent <Player>();
                player.CheckAuthority(GetComponent <NetworkIdentity>(), player.GetComponent <NetworkIdentity>());
                CmdAlphaBaseTranslateForward(transformed.x * Vector3.left);
            }
            else if (alphaBaseFlag && (Vector3.Distance(magnifierBase.transform.parent.gameObject.transform.position, alphaBase.transform.parent.gameObject.transform.position) <= 0.05 * Model.transform.localScale.x))
            {
                var player = ClientScene.localPlayers[0].gameObject.GetComponent <Player>();
                player.CheckAuthority(GetComponent <NetworkIdentity>(), player.GetComponent <NetworkIdentity>());
                CmdAlphaBaseTranslateBack(transformed.x * Vector3.left);
            }
            else if (screenBaseFlag && (Vector3.Distance(magnifierBase.transform.parent.gameObject.transform.position, screenBase.transform.parent.gameObject.transform.position) >= 0.42 * Model.transform.localScale.x))
            {
                var player = ClientScene.localPlayers[0].gameObject.GetComponent <Player>();
                player.CheckAuthority(GetComponent <NetworkIdentity>(), player.GetComponent <NetworkIdentity>());
                CmdScreenBaseTranslateBack(transformed.x * Vector3.left);
            }
            else if (screenBaseFlag && (Vector3.Distance(magnifierBase.transform.parent.gameObject.transform.position, screenBase.transform.parent.gameObject.transform.position) <= 0.05 * Model.transform.localScale.x))
            {
                var player = ClientScene.localPlayers[0].gameObject.GetComponent <Player>();
                player.CheckAuthority(GetComponent <NetworkIdentity>(), player.GetComponent <NetworkIdentity>());
                CmdScreenBaseTranslateForward(transformed.x * Vector3.left);
            }

            if (Input.touchCount > 1)
            {
                h1.ConstantOffImmediate();
                h2.ConstantOffImmediate();
                alphaBaseFlag  = false;
                screenBaseFlag = false;
            }
        }
    }
Esempio n. 21
0
    public IEnumerator Fire(float pressTime)
    {
        if (!startAnimation)
        {
            //射击效果
            calcuLateDistance(pressTime);
            direct = transform.position - gunBarrel.transform.position;
            direct.Normalize();
            direct /= 140;
            _bullet = Instantiate(bulletPrefab) as GameObject;
            _bullet.transform.parent        = gunBarrel.transform;
            _bullet.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
            _bullet.transform.localRotation = Quaternion.identity;
            //_bullet.transform.Rotate(new Vector3(-90, 0, 0));
            remainDistance = fireDistance;
            startAnimation = true;
        }
        while (remainDistance > endThreshold) //未完成飞行
        {
            float step = bulletFlyingSpeed * Time.deltaTime;
            remainDistance -= step;
            //_bullet.transform.Translate(step * direct);
            yield return(0);
        }
        //击中判定
        //////////////////击中动画待添加
        Destroy(_bullet);
        startAnimation = false;
        h.ConstantOffImmediate();
        if ((totalDistance - hitThreshold) < fireDistance && fireDistance < (totalDistance + hitThreshold))
        {
            MainController.add_energy = MainController.add_energy + (int)((1 - System.Math.Abs(totalDistance - fireDistance) / hitThreshold) * 10);
            mainController            = GameObject.FindWithTag("MainController_Feed");
            mainController.GetComponent <MainController>().HitTransform();
            mainController.GetComponent <MainController>().AlterToNextTarget();
            //targetMaterial.shader = HitShader;
            Debug.Log("打中了!!");
        }
        else
        {
            if ((totalDistance - hitThreshold) > fireDistance)//less
            {
                //UIRoot.GetComponent<ButtonManager_Feed>().showLessText();
                GameObject warning = new GameObject("warning");
                warning.transform.position = new Vector3(0, 0, 150);
                Sprite spr = Resources.Load <Sprite>("image/less");
                warning.AddComponent <SpriteRenderer>().sprite       = spr;
                warning.GetComponent <SpriteRenderer>().sortingOrder = 3;
                Destroy(warning, 1);
                print("less");

                /*   GameObject less = new GameObject("less");
                 * less.transform.position = new Vector3(0, 0, 150);
                 * Sprite spr = Resources.Load<Sprite>("image/less");
                 * less.AddComponent<SpriteRenderer>().sprite = spr;
                 * less.GetComponent<SpriteRenderer>().sortingOrder = 3;
                 * Destroy(less, 2);
                 * print("less");*/
            }
            if (fireDistance > (totalDistance + hitThreshold))
            {
                //UIRoot.GetComponent<ButtonManager_Feed>().showMoreText();
                GameObject warning = new GameObject("warning");
                warning.transform.position = new Vector3(0, 0, 150);
                Sprite spr = Resources.Load <Sprite>("image/more");
                warning.AddComponent <SpriteRenderer>().sprite       = spr;
                warning.GetComponent <SpriteRenderer>().sortingOrder = 3;
                Destroy(warning, 1);
                print("less");

                /*   GameObject more = new GameObject("more");
                 * more.transform.position = new Vector3(0, 0, 150);
                 * Sprite spr = Resources.Load<Sprite>("image/more");
                 * more.AddComponent<SpriteRenderer>().sprite = spr;
                 * more.GetComponent<SpriteRenderer>().sortingOrder = 3;
                 * Destroy(more, 2);
                 * print("more");*/
            }
            mainController = GameObject.FindWithTag("MainController_Feed");
            /////////mainController.GetComponent<MainController>().StopTheGame();
            mainController.GetComponent <MainController>().RestartToThisTarget();
            //mainController.GetComponent<MainController>().HitTransform();
            Debug.Log("失败");
        }
    }