public override void Draw(Entity entity, LevelSpriteBatchPool pool, GameTime gameTime) { var center = entity.Position; var menu = entity.GetComponent <CircleMenu>(); var inventory = entity.GetComponent <ComponentInventory>(); var itemCount = inventory.Content.GetStackCount(); pool.Overlay.DrawCircle(center, DISTANCE_FROM_ENTITY * Easing.CircularEaseInOut(menu.Opacity), 16, Color.White); for (var i = 0; i < itemCount; i++) { var angle = i / (float)itemCount * Mathf.TwoPI; var isSelected = i == menu.SelectedItem; var offx = Mathf.Cos(angle) * DISTANCE_FROM_ENTITY; var offy = Mathf.Sin(angle) * DISTANCE_FROM_ENTITY; var off = new Vector2(offx, offy) * Easing.CircularEaseInOut(menu.Opacity); var itemSprite = inventory.Content.GetStack(i).Sprite; pool.Overlay.DrawSprite(itemSprite, new Vector2(1f) + center + off - new Vector2(8 * (isSelected ? SELECTED_SIZE : 1f) * menu.Opacity), (isSelected ? SELECTED_SIZE : 1f) * menu.Opacity, Color.Black * menu.Opacity * 0.45f); pool.Overlay.DrawSprite(itemSprite, center + off - new Vector2(8 * (isSelected ? SELECTED_SIZE : 1f) * menu.Opacity), (isSelected ? SELECTED_SIZE : 1f) * menu.Opacity, Color.White * menu.Opacity); } }
public override void Draw(Entity entity, LevelSpriteBatchPool pool, GameTime gameTime) { if (entity.HasComponent <ComponentCastShadow>(out var shadow) && !(entity.GetComponent <ComponentSwim>()?.IsSwiming ?? false)) { pool.Shadows.Draw(Resources.ImgShadow, new Vector2(entity.X - 7 * shadow.Scale, entity.Y - 3f * shadow.Scale), new Vector2(14, 6) * shadow.Scale, Color.White); } }
public override void Draw(Entity entity, LevelSpriteBatchPool pool, GameTime gameTime) { var light = entity.GetComponent <ComponentLightSource>(); if (entity.HasComponent <ComponentPickup>(out var pickup) && pickup.PickedUpEntity != null) { if (pickup.PickedUpEntity.HasComponent <ComponentLightSource>(out var pickupLight)) { light = pickupLight; } } if (light != null && light.IsOn) { DrawLight(pool.Lights, entity.X, entity.Y, light.Power, light.Color); } }
public override void Draw(Entity entity, LevelSpriteBatchPool pool, GameTime gameTime) { var health = Mathf.Max(entity.GetComponent <ComponentHealth>().ValuePercent, 0.05f); if (health < 0.95f) { var barPosition = entity.Position + new Vector2(0, 4) - new Vector2(HEALTH_BAR_WIDTH / 2, HEALTH_BAR_HEIGHT / 2); var barBound = new Vector2(HEALTH_BAR_WIDTH * health, HEALTH_BAR_HEIGHT); pool.Overlay.FillRectangle(barPosition + new Vector2(1f, 1f), barBound, Color.Black * 0.45f); var red = (int)Math.Sqrt(255 * 255 * (1 - health)); var green = (int)Math.Sqrt(255 * 255 * health); pool.Overlay.FillRectangle(barPosition, barBound, new Color(red, green, 0)); pool.Overlay.Draw(Resources.ImgHealthbar, barPosition - new Vector2(3), Resources.ImgHealthbar.Bounds.Size.ToVector2(), Color.White); } }
public abstract void Draw(Entity entity, LevelSpriteBatchPool pool, GameTime gameTime);
public override void Draw(Entity entity, LevelSpriteBatchPool pool, GameTime gameTime) { entity.GetComponent <Renderer>().Render(pool.Entities, entity, entity.Position, gameTime); }