bool CheckHit(GUIQuadObj pQuadObj, RaycastHit pHit) { Texture2D MaterialTexture = (Texture2D)material.GetTexture("_MainTex"); //Calculate the XY coord where the ray hit the texture Vector2 TextureXY = pQuadObj.UV + ((Vector2)(pHit.point - pHit.collider.gameObject.transform.position)); TextureXY.x = TextureXY.x + (pQuadObj.Width / 2); TextureXY.y = MaterialTexture.height - (TextureXY.y - (pQuadObj.Height / 2)); //Get alpha value Color PixColor = MaterialTexture.GetPixel((int)TextureXY.x, (int)TextureXY.y); //Send collision message if alpha is greater than .25 if (PixColor.a > 0.25f) { return(true); } return(false); }
void Awake() { thisObj = (GUIQuadObj)gameObject.GetComponent(typeof(GUIQuadObj)); }
void Awake() { thisObj = (GUIQuadObj)gameObject.GetComponent(typeof(GUIQuadObj)); DepthDir = true; }
bool CheckHit(GUIQuadObj pQuadObj, RaycastHit pHit) { Texture2D MaterialTexture = (Texture2D) material.GetTexture ("_MainTex"); //Calculate the XY coord where the ray hit the texture Vector2 TextureXY = pQuadObj.UV + ((Vector2) (pHit.point - pHit.collider.gameObject.transform.position)); TextureXY.x = TextureXY.x + (pQuadObj.Width / 2); TextureXY.y = MaterialTexture.height - (TextureXY.y - (pQuadObj.Height / 2)); //Get alpha value Color PixColor = MaterialTexture.GetPixel((int)TextureXY.x, (int)TextureXY.y); //Send collision message if alpha is greater than .25 if (PixColor.a > 0.25f) { return true; } return false; }
void Awake() { thisObj = (GUIQuadObj)gameObject.GetComponent(typeof(GUIQuadObj)); FadeDir = true; ptrGUIMgr = (GUIManager)GameObject.Find("GUI").GetComponent(typeof(GUIManager)); }