コード例 #1
0
 private void UpdateServiceContainer()
 {
     if (base.enabled && base.gameObject.activeSelf)
     {
         if (this.whLayer == -1)
         {
             this.whLayer = LayerMask.NameToLayer("Ignore Raycast");
         }
         if (this.raycastMask == -1)
         {
             this.raycastMask = LayerMask.GetMask(new string[]
             {
                 "Ignore Raycast"
             });
         }
         if (this.serviceContainer == null)
         {
             this.serviceContainer       = new GameObject("[WH Detector Service]");
             this.serviceContainer.layer = this.whLayer;
             this.serviceContainer.transform.position = this.spawnPosition;
             UnityEngine.Object.DontDestroyOnLoad(this.serviceContainer);
         }
         if ((this.checkRigidbody || this.checkController) && this.solidWall == null)
         {
             this.solidWall = new GameObject("SolidWall");
             this.solidWall.AddComponent <BoxCollider>();
             this.solidWall.layer                   = this.whLayer;
             this.solidWall.transform.parent        = this.serviceContainer.transform;
             this.solidWall.transform.localScale    = new Vector3(3f, 3f, 0.5f);
             this.solidWall.transform.localPosition = Vector3.zero;
         }
         else if (!this.checkRigidbody && !this.checkController && this.solidWall != null)
         {
             UnityEngine.Object.Destroy(this.solidWall);
         }
         if (this.checkWireframe && this.wfCamera == null)
         {
             if (this.wfShader == null)
             {
                 this.wfShader = Shader.Find("Hidden/ACTk/WallHackTexture");
             }
             if (this.wfShader == null)
             {
                 UnityEngine.Debug.LogError("[ACTk] WallHack Detector: can't find 'Hidden/ACTk/WallHackTexture' shader!\nPlease make sure you have it included at the Editor > Project Settings > Graphics.", this);
                 this.checkWireframe = false;
             }
             else if (!this.wfShader.isSupported)
             {
                 UnityEngine.Debug.LogError("[ACTk] WallHack Detector: can't detect wireframe cheats on this platform!", this);
                 this.checkWireframe = false;
             }
             else
             {
                 if (this.wfColor1 == Color.black)
                 {
                     this.wfColor1 = WallHackDetector.GenerateColor();
                     do
                     {
                         this.wfColor2 = WallHackDetector.GenerateColor();
                     }while (WallHackDetector.ColorsSimilar(this.wfColor1, this.wfColor2, 10));
                 }
                 if (this.shaderTexture == null)
                 {
                     this.shaderTexture            = new Texture2D(4, 4, TextureFormat.RGB24, false);
                     this.shaderTexture.filterMode = FilterMode.Point;
                     Color[] array = new Color[16];
                     for (int i = 0; i < 16; i++)
                     {
                         if (i < 8)
                         {
                             array[i] = this.wfColor1;
                         }
                         else
                         {
                             array[i] = this.wfColor2;
                         }
                     }
                     this.shaderTexture.SetPixels(array, 0);
                     this.shaderTexture.Apply();
                 }
                 if (this.renderTexture == null)
                 {
                     this.renderTexture = new RenderTexture(4, 4, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default);
                     this.renderTexture.generateMips = false;
                     this.renderTexture.filterMode   = FilterMode.Point;
                     this.renderTexture.Create();
                 }
                 if (this.targetTexture == null)
                 {
                     this.targetTexture            = new Texture2D(4, 4, TextureFormat.RGB24, false);
                     this.targetTexture.filterMode = FilterMode.Point;
                 }
                 if (this.wfMaterial == null)
                 {
                     this.wfMaterial             = new Material(this.wfShader);
                     this.wfMaterial.mainTexture = this.shaderTexture;
                 }
                 if (this.foregroundRenderer == null)
                 {
                     GameObject gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube);
                     UnityEngine.Object.Destroy(gameObject.GetComponent <BoxCollider>());
                     gameObject.name                           = "WireframeFore";
                     gameObject.layer                          = this.whLayer;
                     gameObject.transform.parent               = this.serviceContainer.transform;
                     gameObject.transform.localPosition        = new Vector3(0f, 0f, 0f);
                     this.foregroundRenderer                   = gameObject.GetComponent <MeshRenderer>();
                     this.foregroundRenderer.sharedMaterial    = this.wfMaterial;
                     this.foregroundRenderer.shadowCastingMode = ShadowCastingMode.Off;
                     this.foregroundRenderer.receiveShadows    = false;
                     this.foregroundRenderer.enabled           = false;
                 }
                 if (this.backgroundRenderer == null)
                 {
                     GameObject gameObject2 = GameObject.CreatePrimitive(PrimitiveType.Quad);
                     UnityEngine.Object.Destroy(gameObject2.GetComponent <MeshCollider>());
                     gameObject2.name                          = "WireframeBack";
                     gameObject2.layer                         = this.whLayer;
                     gameObject2.transform.parent              = this.serviceContainer.transform;
                     gameObject2.transform.localPosition       = new Vector3(0f, 0f, 1f);
                     gameObject2.transform.localScale          = new Vector3(0.7f, 0.7f, 0.7f);
                     this.backgroundRenderer                   = gameObject2.GetComponent <MeshRenderer>();
                     this.backgroundRenderer.sharedMaterial    = this.wfMaterial;
                     this.backgroundRenderer.shadowCastingMode = ShadowCastingMode.Off;
                     this.backgroundRenderer.receiveShadows    = false;
                     this.backgroundRenderer.enabled           = false;
                 }
                 if (this.wfCamera == null)
                 {
                     this.wfCamera = new GameObject("WireframeCamera").AddComponent <Camera>();
                     this.wfCamera.gameObject.layer        = this.whLayer;
                     this.wfCamera.transform.parent        = this.serviceContainer.transform;
                     this.wfCamera.transform.localPosition = new Vector3(0f, 0f, -1f);
                     this.wfCamera.clearFlags          = CameraClearFlags.Color;
                     this.wfCamera.backgroundColor     = Color.black;
                     this.wfCamera.orthographic        = true;
                     this.wfCamera.orthographicSize    = 0.5f;
                     this.wfCamera.nearClipPlane       = 0.01f;
                     this.wfCamera.farClipPlane        = 2.1f;
                     this.wfCamera.depth               = 0f;
                     this.wfCamera.renderingPath       = RenderingPath.Forward;
                     this.wfCamera.useOcclusionCulling = false;
                     this.wfCamera.hdr           = false;
                     this.wfCamera.targetTexture = this.renderTexture;
                     this.wfCamera.enabled       = false;
                 }
             }
         }
         else if (!this.checkWireframe && this.wfCamera != null)
         {
             UnityEngine.Object.Destroy(this.foregroundRenderer.gameObject);
             UnityEngine.Object.Destroy(this.backgroundRenderer.gameObject);
             this.wfCamera.targetTexture = null;
             UnityEngine.Object.Destroy(this.wfCamera.gameObject);
         }
         if (this.checkRaycast && this.thinWall == null)
         {
             this.thinWall                         = GameObject.CreatePrimitive(PrimitiveType.Plane);
             this.thinWall.name                    = "ThinWall";
             this.thinWall.layer                   = this.whLayer;
             this.thinWall.transform.parent        = this.serviceContainer.transform;
             this.thinWall.transform.localScale    = new Vector3(0.2f, 1f, 0.2f);
             this.thinWall.transform.localRotation = Quaternion.Euler(270f, 0f, 0f);
             this.thinWall.transform.localPosition = new Vector3(0f, 0f, 1.4f);
             UnityEngine.Object.Destroy(this.thinWall.GetComponent <Renderer>());
             UnityEngine.Object.Destroy(this.thinWall.GetComponent <MeshFilter>());
         }
         else if (!this.checkRaycast && this.thinWall != null)
         {
             UnityEngine.Object.Destroy(this.thinWall);
         }
     }
     else if (this.serviceContainer != null)
     {
         UnityEngine.Object.Destroy(this.serviceContainer);
     }
 }
コード例 #2
0
 public static void StartDetection(UnityAction callback)
 {
     WallHackDetector.StartDetection(callback, WallHackDetector.GetOrCreateInstance.spawnPosition);
 }
コード例 #3
0
 public static void StartDetection(UnityAction callback, Vector3 spawnPosition)
 {
     WallHackDetector.StartDetection(callback, spawnPosition, WallHackDetector.GetOrCreateInstance.maxFalsePositives);
 }
コード例 #4
0
 private void UpdateServiceContainer()
 {
     if (((Behaviour)this).get_enabled() && ((Component)this).get_gameObject().get_activeSelf())
     {
         if (this.whLayer == -1)
         {
             this.whLayer = LayerMask.NameToLayer("Ignore Raycast");
         }
         if (this.raycastMask == -1)
         {
             this.raycastMask = LayerMask.GetMask(new string[1]
             {
                 "Ignore Raycast"
             });
         }
         if (Object.op_Equality((Object)this.serviceContainer, (Object)null))
         {
             this.serviceContainer = new GameObject("[WH Detector Service]");
             this.serviceContainer.set_layer(this.whLayer);
             this.serviceContainer.get_transform().set_position(this.spawnPosition);
             Object.DontDestroyOnLoad((Object)this.serviceContainer);
         }
         if ((this.checkRigidbody || this.checkController) && Object.op_Equality((Object)this.solidWall, (Object)null))
         {
             this.solidWall = new GameObject("SolidWall");
             this.solidWall.AddComponent <BoxCollider>();
             this.solidWall.set_layer(this.whLayer);
             this.solidWall.get_transform().set_parent(this.serviceContainer.get_transform());
             this.solidWall.get_transform().set_localScale(new Vector3(3f, 3f, 0.5f));
             this.solidWall.get_transform().set_localPosition(Vector3.get_zero());
         }
         else if (!this.checkRigidbody && !this.checkController && Object.op_Inequality((Object)this.solidWall, (Object)null))
         {
             Object.Destroy((Object)this.solidWall);
         }
         if (this.checkWireframe && Object.op_Equality((Object)this.wfCamera, (Object)null))
         {
             if (Object.op_Equality((Object)this.wfShader, (Object)null))
             {
                 this.wfShader = Shader.Find("Hidden/ACTk/WallHackTexture");
             }
             if (Object.op_Equality((Object)this.wfShader, (Object)null))
             {
                 Debug.LogError((object)"[ACTk] WallHack Detector: can't find 'Hidden/ACTk/WallHackTexture' shader!\nPlease make sure you have it included at the Editor > Project Settings > Graphics.", (Object)this);
                 this.checkWireframe = false;
             }
             else if (!this.wfShader.get_isSupported())
             {
                 Debug.LogError((object)"[ACTk] WallHack Detector: can't detect wireframe cheats on this platform!", (Object)this);
                 this.checkWireframe = false;
             }
             else
             {
                 if (Color.op_Equality(this.wfColor1, Color.get_black()))
                 {
                     this.wfColor1 = Color32.op_Implicit(WallHackDetector.GenerateColor());
                     do
                     {
                         this.wfColor2 = Color32.op_Implicit(WallHackDetector.GenerateColor());
                     }while (WallHackDetector.ColorsSimilar(Color32.op_Implicit(this.wfColor1), Color32.op_Implicit(this.wfColor2), 10));
                 }
                 if (Object.op_Equality((Object)this.shaderTexture, (Object)null))
                 {
                     this.shaderTexture = new Texture2D(4, 4, (TextureFormat)3, false);
                     ((Texture)this.shaderTexture).set_filterMode((FilterMode)0);
                     Color[] colorArray = new Color[16];
                     for (int index = 0; index < 16; ++index)
                     {
                         colorArray[index] = index >= 8 ? this.wfColor2 : this.wfColor1;
                     }
                     this.shaderTexture.SetPixels(colorArray, 0);
                     this.shaderTexture.Apply();
                 }
                 if (Object.op_Equality((Object)this.renderTexture, (Object)null))
                 {
                     this.renderTexture = new RenderTexture(4, 4, 24, (RenderTextureFormat)0, (RenderTextureReadWrite)0);
                     this.renderTexture.set_generateMips(false);
                     ((Texture)this.renderTexture).set_filterMode((FilterMode)0);
                     this.renderTexture.Create();
                 }
                 if (Object.op_Equality((Object)this.targetTexture, (Object)null))
                 {
                     this.targetTexture = new Texture2D(4, 4, (TextureFormat)3, false);
                     ((Texture)this.targetTexture).set_filterMode((FilterMode)0);
                 }
                 if (Object.op_Equality((Object)this.wfMaterial, (Object)null))
                 {
                     this.wfMaterial = new Material(this.wfShader);
                     this.wfMaterial.set_mainTexture((Texture)this.shaderTexture);
                 }
                 if (Object.op_Equality((Object)this.foregroundRenderer, (Object)null))
                 {
                     GameObject primitive = GameObject.CreatePrimitive((PrimitiveType)3);
                     Object.Destroy((Object)primitive.GetComponent <BoxCollider>());
                     ((Object)primitive).set_name("WireframeFore");
                     primitive.set_layer(this.whLayer);
                     primitive.get_transform().set_parent(this.serviceContainer.get_transform());
                     primitive.get_transform().set_localPosition(new Vector3(0.0f, 0.0f, 0.0f));
                     this.foregroundRenderer = (MeshRenderer)primitive.GetComponent <MeshRenderer>();
                     ((Renderer)this.foregroundRenderer).set_sharedMaterial(this.wfMaterial);
                     ((Renderer)this.foregroundRenderer).set_shadowCastingMode((ShadowCastingMode)0);
                     ((Renderer)this.foregroundRenderer).set_receiveShadows(false);
                     ((Renderer)this.foregroundRenderer).set_enabled(false);
                 }
                 if (Object.op_Equality((Object)this.backgroundRenderer, (Object)null))
                 {
                     GameObject primitive = GameObject.CreatePrimitive((PrimitiveType)5);
                     Object.Destroy((Object)primitive.GetComponent <MeshCollider>());
                     ((Object)primitive).set_name("WireframeBack");
                     primitive.set_layer(this.whLayer);
                     primitive.get_transform().set_parent(this.serviceContainer.get_transform());
                     primitive.get_transform().set_localPosition(new Vector3(0.0f, 0.0f, 1f));
                     primitive.get_transform().set_localScale(new Vector3(0.7f, 0.7f, 0.7f));
                     this.backgroundRenderer = (MeshRenderer)primitive.GetComponent <MeshRenderer>();
                     ((Renderer)this.backgroundRenderer).set_sharedMaterial(this.wfMaterial);
                     ((Renderer)this.backgroundRenderer).set_shadowCastingMode((ShadowCastingMode)0);
                     ((Renderer)this.backgroundRenderer).set_receiveShadows(false);
                     ((Renderer)this.backgroundRenderer).set_enabled(false);
                 }
                 if (Object.op_Equality((Object)this.wfCamera, (Object)null))
                 {
                     this.wfCamera = (Camera) new GameObject("WireframeCamera").AddComponent <Camera>();
                     ((Component)this.wfCamera).get_gameObject().set_layer(this.whLayer);
                     ((Component)this.wfCamera).get_transform().set_parent(this.serviceContainer.get_transform());
                     ((Component)this.wfCamera).get_transform().set_localPosition(new Vector3(0.0f, 0.0f, -1f));
                     this.wfCamera.set_clearFlags((CameraClearFlags)2);
                     this.wfCamera.set_backgroundColor(Color.get_black());
                     this.wfCamera.set_orthographic(true);
                     this.wfCamera.set_orthographicSize(0.5f);
                     this.wfCamera.set_nearClipPlane(0.01f);
                     this.wfCamera.set_farClipPlane(2.1f);
                     this.wfCamera.set_depth(0.0f);
                     this.wfCamera.set_renderingPath((RenderingPath)1);
                     this.wfCamera.set_useOcclusionCulling(false);
                     this.wfCamera.set_hdr(false);
                     this.wfCamera.set_targetTexture(this.renderTexture);
                     ((Behaviour)this.wfCamera).set_enabled(false);
                 }
             }
         }
         else if (!this.checkWireframe && Object.op_Inequality((Object)this.wfCamera, (Object)null))
         {
             Object.Destroy((Object)((Component)this.foregroundRenderer).get_gameObject());
             Object.Destroy((Object)((Component)this.backgroundRenderer).get_gameObject());
             this.wfCamera.set_targetTexture((RenderTexture)null);
             Object.Destroy((Object)((Component)this.wfCamera).get_gameObject());
         }
         if (this.checkRaycast && Object.op_Equality((Object)this.thinWall, (Object)null))
         {
             this.thinWall = GameObject.CreatePrimitive((PrimitiveType)4);
             ((Object)this.thinWall).set_name("ThinWall");
             this.thinWall.set_layer(this.whLayer);
             this.thinWall.get_transform().set_parent(this.serviceContainer.get_transform());
             this.thinWall.get_transform().set_localScale(new Vector3(0.2f, 1f, 0.2f));
             this.thinWall.get_transform().set_localRotation(Quaternion.Euler(270f, 0.0f, 0.0f));
             this.thinWall.get_transform().set_localPosition(new Vector3(0.0f, 0.0f, 1.4f));
             Object.Destroy((Object)this.thinWall.GetComponent <Renderer>());
             Object.Destroy((Object)this.thinWall.GetComponent <MeshFilter>());
         }
         else
         {
             if (this.checkRaycast || !Object.op_Inequality((Object)this.thinWall, (Object)null))
             {
                 return;
             }
             Object.Destroy((Object)this.thinWall);
         }
     }
     else
     {
         if (!Object.op_Inequality((Object)this.serviceContainer, (Object)null))
         {
             return;
         }
         Object.Destroy((Object)this.serviceContainer);
     }
 }