Class PowerGrid
Inheritance
System.Object
PowerGrid
Assembly: Eco.Gameplay.dll
Syntax
public class PowerGrid : Object, IController, IViewController, IHasUniversalID
Constructors
PowerGrid(PowerGridComponent)
Declaration
public PowerGrid(PowerGridComponent component)
Parameters
Fields
EnergyType
Declaration
public readonly IPowerEnergyType EnergyType
Field Value
Properties
ComponentCount
Declaration
public int ComponentCount { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Components
Declaration
public IEnumerable<PowerGridComponent> Components { get; }
Property Value
ControllerID
Declaration
public ref int ControllerID { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Efficiency
Declaration
public float Efficiency { get; }
Property Value
| Type |
Description |
| System.Single |
|
EnergyDemand
Declaration
public float EnergyDemand { get; }
Property Value
| Type |
Description |
| System.Single |
|
EnergySupply
Declaration
public float EnergySupply { get; }
Property Value
| Type |
Description |
| System.Single |
|
EnergyTypeName
Declaration
public string EnergyTypeName { get; }
Property Value
| Type |
Description |
| System.String |
|
Load
Declaration
public float Load { get; }
Property Value
| Type |
Description |
| System.Single |
|
Methods
Cleanup()
Clears internal storage and removes this power grid from PowerGridManager, which will stop ticking this power grid. Call this function when the power grid should be destroyed.
Declaration
DisconnectAndSplit(PowerGridComponent)
Remove a component from the power grid. Detect whether removing the component breaks the connected-ness of the power grid connection graph. If that is the case, split this power grid into multiple grids based on connected components.
Declaration
public void DisconnectAndSplit(PowerGridComponent disconnectComponent)
Parameters
IsEmpty()
Declaration
Returns
| Type |
Description |
| System.Boolean |
|
Join(PowerGridComponent, PowerGridComponent)
Add current to target's power grid and mark them as connected.
Declaration
public static void Join(PowerGridComponent current, PowerGridComponent target)
Parameters
Tick()
Tick the power grid, update the stored power supply and demand. All power grids tick in parallel, so no race conditions allowed here.
Declaration
TryAccumulate(Single, out Single)
Declaration
public bool TryAccumulate(float requestedAmount, out float accumulated)
Parameters
| Type |
Name |
Description |
| System.Single |
requestedAmount |
|
| System.Single |
accumulated |
|
Returns
| Type |
Description |
| System.Boolean |
|
Implements
Extension Methods