* Non-accessed local variable * Merge cast and type checks. * StringComparison.Ordinal added for better culture support * Supposed code improvement in launcher. Remove unused code. * Update ExplosionHelper.cs Unintentional change. * Optimized Import * Add Robust.Shared.Utility import where it was deleted * Other random suggestion * Improve my comment
33 lines
1015 B
C#
33 lines
1015 B
C#
using Content.Shared.GameObjects.Components.Power;
|
|
using Content.Shared.Utility;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Client.Interfaces.GameObjects.Components;
|
|
using Robust.Shared.Utility;
|
|
using YamlDotNet.RepresentationModel;
|
|
|
|
namespace Content.Client.GameObjects.Components.Power
|
|
{
|
|
public class HitscanWeaponVisualizer2D : AppearanceVisualizer
|
|
{
|
|
private string _prefix;
|
|
|
|
public override void LoadData(YamlMappingNode node)
|
|
{
|
|
base.LoadData(node);
|
|
|
|
_prefix = node.GetNode("prefix").AsString();
|
|
}
|
|
|
|
public override void OnChangeData(AppearanceComponent component)
|
|
{
|
|
base.OnChangeData(component);
|
|
|
|
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
|
if (component.TryGetData(PowerCellVisuals.ChargeLevel, out float fraction))
|
|
{
|
|
sprite.LayerSetState(0, $"{_prefix}_{ContentHelpers.RoundToLevels(fraction, 1, 5) * 25}");
|
|
}
|
|
}
|
|
}
|
|
}
|