APC & SMES appearances. (#78)
* CEV-Eris SMES sprite as RSI. Has been modified so that the light overlay states use alpha blending. * Add tiny glow to SMES display sprite. * Appearances work v2 * More WiP * RoundToLevels works correctly on even level counts now. * SMES -> Smes because MS guidelines. * CEV-Eris APC sprite. * APC visuals. * Reduce SMES scale again to normal levels. * Update submodule
This commit is contained in:
committed by
GitHub
parent
7629d447aa
commit
ad5c82fec9
50
Content.Server/GameObjects/Components/Power/ApcComponent.cs
Normal file
50
Content.Server/GameObjects/Components/Power/ApcComponent.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Content.Shared.GameObjects.Components.Power;
|
||||
using SS14.Server.GameObjects;
|
||||
using SS14.Shared.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Power
|
||||
{
|
||||
public class ApcComponent : Component
|
||||
{
|
||||
public override string Name => "Apc";
|
||||
|
||||
PowerStorageComponent Storage;
|
||||
AppearanceComponent Appearance;
|
||||
|
||||
ApcChargeState LastChargeState;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Storage = Owner.GetComponent<PowerStorageComponent>();
|
||||
Appearance = Owner.GetComponent<AppearanceComponent>();
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
var newState = CalcChargeState();
|
||||
if (newState != LastChargeState)
|
||||
{
|
||||
LastChargeState = newState;
|
||||
Appearance.SetData(ApcVisuals.ChargeState, newState);
|
||||
}
|
||||
}
|
||||
|
||||
ApcChargeState CalcChargeState()
|
||||
{
|
||||
var storageCharge = Storage.GetChargeState();
|
||||
if (storageCharge == ChargeState.Discharging)
|
||||
{
|
||||
return ApcChargeState.Lack;
|
||||
}
|
||||
|
||||
if (storageCharge == ChargeState.Charging)
|
||||
{
|
||||
return ApcChargeState.Charging;
|
||||
}
|
||||
|
||||
// Still.
|
||||
return Storage.Full ? ApcChargeState.Full : ApcChargeState.Lack;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user