Added simple power loss mechanic
Also added two UI texts to see power consumption and generation
This commit is contained in:
parent
813d034fc5
commit
bee2db1354
|
@ -2,18 +2,59 @@ namespace GameDev.CoreSystems
|
|||
{
|
||||
public interface IPowerSystem
|
||||
{
|
||||
/// <summary>
|
||||
/// This entity generates power
|
||||
/// </summary>
|
||||
public bool IsGenerator { get; }
|
||||
|
||||
/// <summary>
|
||||
/// This entity consumes power
|
||||
/// </summary>
|
||||
public bool IsConsumer { get; }
|
||||
|
||||
public void SetMaxPower(int newValue);
|
||||
/// <summary>
|
||||
/// True if consumer demand exceed generator capacity
|
||||
/// </summary>
|
||||
public bool PowerLost { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the power configuration of the entity with the <see cref="SoPowerConfig"/>
|
||||
/// </summary>
|
||||
/// <param name="config">Power config for the entity</param>
|
||||
public void Initialize(SoPowerConfig config);
|
||||
|
||||
/// <summary>
|
||||
/// Max power for the entity
|
||||
/// Generator capacity or max consumption depending on
|
||||
/// the set type <see cref="IsGenerator"/> or <see cref="IsConsumer"/>
|
||||
/// </summary>
|
||||
/// <param name="newMaxPowerValue"></param>
|
||||
public void SetMaxPower(int newMaxPowerValue);
|
||||
|
||||
/// <summary>
|
||||
/// Current power for the entity
|
||||
/// </summary>
|
||||
/// <param name="newCurrentPowerValue">current power generated/consumed power for this entity [W]</param>
|
||||
public void SetCurrentPower(int newCurrentPowerValue);
|
||||
|
||||
/// <summary>
|
||||
/// Get Max power for the entity
|
||||
/// Generator capacity or max consumption depending on
|
||||
/// the set type <see cref="IsGenerator"/> or <see cref="IsConsumer"/>
|
||||
/// </summary>
|
||||
/// <returns>The max power that can be generated/consumed by this entity [W]</returns>
|
||||
public int GetMaxPower();
|
||||
|
||||
/// <summary>
|
||||
/// Get current power for the entity.
|
||||
/// </summary>
|
||||
/// <returns>The power generated/consumed by this entity right now [W]</returns>
|
||||
public int GetCurrentPower();
|
||||
|
||||
/// <summary>
|
||||
/// Get the power factor for the entity
|
||||
/// </summary>
|
||||
/// <returns>The ratio between current power and max power [factor]</returns>
|
||||
public float GetPowerFactor();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue