public void Draw(SpriteBatch spriteBatch, Character character, BoundRectangle boundRect, float rotation = 0, bool isProjectile = false) { Color color = Color.White; int shift = 0; if (!isProjectile) { if (character.Entity.IsInvisible) { return; } if (character.Entity.IsFreezed) { color = Color.Blue; } } shift = (int)((0.5f - animations[currentAnimation].CenterShift) * animations[currentAnimation].FrameWidth * Scale); if (animations[currentAnimation].IsReverseToLeft) { shift = -shift; } spriteBatch.Draw(texture, boundRect.BottomCenter + new Vector2(shift, -Height / 2), animations[currentAnimation].CurrentFrameRect, color, rotation, new Vector2(animations[currentAnimation].FrameWidth / 2, animations[currentAnimation].FrameHeight / 2), Scale, animations[currentAnimation].IsReverseToLeft ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); }
public NetworkPlayerState(BoundRectangle boundRect, Vector2 position, bool isFlying, bool isGrounded, bool isKnockedBack, Vector2 velocity) { this.boundRect = boundRect; this.position = position; this.isFlying = isFlying; this.isGrounded = isGrounded; this.isKnockedBack = isKnockedBack; this.velocity = velocity; }
public virtual void Draw(SpriteBatch spriteBatch, BoundRectangle boundRect) { if (Entity.IsModelChanged && Entity.CurrentReplacedModel != null) { Sprite.PerformAnimation = false; Sprite.ResetCurrentAnimation(); Entity.CurrentReplacedModel.Draw(spriteBatch, this, boundRect); } else { Sprite.Draw(spriteBatch, this, boundRect); } }