public UpdateEventArgs(GameTime gameTime) { GameTime = gameTime; }
/// <summary> /// Draws this GameObject. By default, nothing happens, but other classes can override this method. /// </summary> /// <param name="gameTime">An object containing information about the time that has passed.</param> /// <param name="spriteBatch">The sprite batch to use.</param> public virtual void Draw(GameTime gameTime, SpriteBatch spriteBatch) { }
public void PublishUpdate(GameTime gameTime) { if (Update != null) Update(this, new UpdateEventArgs(gameTime)); }
/// <summary> /// Updates this GameObject by one frame. /// By default, this method updates the object's position according to its velocity. /// You can override this method to create your own custom behavior. /// </summary> /// <param name="gameTime">An object containing information about the time that has passed.</param> public virtual void Update(GameTime gameTime) { LocalPosition += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds; }