public override void Update(GameTime gt) { fade = 1 - (Vector2.Distance(Position, m_StartingPosition) / m_MaxDistFromStart); if (Vector2.Distance(Position, m_StartingPosition) > m_MaxDistFromStart || m_Velocity.Length() <= 0.01f || GetRect.Intersects(new Rectangle((int)Mouse.GetState().Position.X, (int)Mouse.GetState().Position.Y, 16, 16))) { m_isAlive = false; } base.Update(gt); }
public ActionResult GetRandom() { //List<Product> mostViewed = context.ProductFactory.GetAll().OrderBy(x => x.Views).Take(3).ToList(); GetRect getRect = new GetRect() { Product = context.ProductFactory.TakeRandom(1).FirstOrDefault(), Category = context.CategoryFactory.TakeRandom(1).FirstOrDefault(), Comment = context.CommentFactory.TakeRandom(1).FirstOrDefault() }; return(Json(new { html = Render.RenderPartialToString(this, "GetRandom", getRect) }, JsonRequestBehavior.AllowGet)); }
Rect ToRectValue(IntPtr L, int pos) { pos = LuaDLL.abs_index(L, pos); LuaDLL.lua_getref(L, GetRect.GetReference()); LuaDLL.lua_pushvalue(L, pos); LuaDLL.lua_call(L, 1, 4); float x = (float)LuaDLL.lua_tonumber(L, -4); float y = (float)LuaDLL.lua_tonumber(L, -3); float w = (float)LuaDLL.lua_tonumber(L, -2); float h = (float)LuaDLL.lua_tonumber(L, -1); LuaDLL.lua_pop(L, 4); return(new Rect(x, y, w, h)); }
public bool CheckCollision(Rectangle a_OtherRectangle) { return(GetRect.Intersects(a_OtherRectangle)); }