protected override void DrawSelf(SpriteBatch spriteBatch) { CalculatedStyle dimensions = GetDimensions(); long delta = energy.GetEnergy() - oldEnergy; oldEnergy = energy.GetEnergy(); float progress = energy.GetEnergy() / (float)energy.GetCapacity(); DrawBar(spriteBatch, bgColor); spriteBatch.End(); RasterizerState state = new RasterizerState { ScissorTestEnable = true }; spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, state); Rectangle prevRect = spriteBatch.GraphicsDevice.ScissorRectangle; spriteBatch.GraphicsDevice.ScissorRectangle = new Rectangle((int)dimensions.X, (int)(dimensions.Y + dimensions.Height - dimensions.Height * progress), (int)dimensions.Width, (int)(dimensions.Height * progress)); DrawBar(spriteBatch, barColor); spriteBatch.GraphicsDevice.ScissorRectangle = prevRect; spriteBatch.End(); spriteBatch.Begin(); if (IsMouseHovering) { Main.LocalPlayer.showItemIcon = false; Main.ItemIconCacheUpdate(0); Main.instance.MouseTextHackZoom($"{energy}\n{(delta > 0 ? "+" : "") + delta.AsPower(true)}"); Main.mouseText = true; } }
public long GetCapacity() => energyStorage.GetCapacity();
public long GetCapacity() => energy.GetCapacity();
public static long CalculateGeneration(long energy, EnergyStorage storage) => Math.Min(energy, storage.GetCapacity() - storage.GetEnergy());
public long GetCapacitySharePerNode() => energy.GetCapacity() / tiles.Count;