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 GetEnergy() => energyStorage.GetEnergy();
public long GetEnergy() => energy.GetEnergy();
public static long CalculateGeneration(long energy, EnergyStorage storage) => Math.Min(energy, storage.GetCapacity() - storage.GetEnergy());
public long GetEnergySharePerNode() => energy.GetEnergy() / tiles.Count;
public float GetEnergySharePerNode() => (float)energy.GetEnergy() / tiles.Count;