/// <summary> /// Allows the game component to update itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> public override void Update(GameTime gameTime) { // TODO: Add your update code here //Elapsed time since last update lastUpdateTime = (float)gameTime.ElapsedGameTime.TotalMilliseconds; //GamePad1 SpriteEffects = SpriteEffects.None; //Default Sprite Effects this.spriteTexture = this.spriteAnimationAdapter.CurrentTexture; //update texture for collision Rectangle currentTextureRect = spriteAnimationAdapter.GetCurrentDrawRect(lastUpdateTime); this.locationRect = new Rectangle((int)Location.X - (int)this.Orgin.X, (int)Location.Y - (int)this.Orgin.Y, currentTextureRect.Width, currentTextureRect.Height); base.Update(gameTime); }
/// <summary> /// Allows the game component to update itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> public override void Update(GameTime gameTime) { //Elapsed time since last update lastUpdateTime = (float)gameTime.ElapsedGameTime.TotalMilliseconds; SpriteEffects = SpriteEffects.None; //Default Sprite Effects if (this.spriteAnimationAdapter.HasAnimations) { this.spriteTexture = this.spriteAnimationAdapter.CurrentTexture; //update texture for collision } base.Update(gameTime); currentTextureRect = spriteAnimationAdapter.GetCurrentDrawRect(lastUpdateTime, this.scale); SetTranformAndRect(); //HACK this.SpriteTextureData = new Color[this.spriteAnimationAdapter.CurrentTexture.Width * this.spriteAnimationAdapter.CurrentTexture.Height]; this.spriteAnimationAdapter.CurrentTexture.GetData(this.SpriteTextureData); }