Class ResourceCost
- Namespace
- MoonBark.GridPlacement.Core.Types
- Assembly
- MoonBark.GridPlacement.Core.dll
Represents a cost for a specific resource.
public record ResourceCost : IEquatable<ResourceCost>
- Inheritance
-
ResourceCost
- Implements
- Inherited Members
Constructors
ResourceCost(ResourceId, int)
Represents a cost for a specific resource.
public ResourceCost(ResourceId Resource, int Amount)
Parameters
ResourceResourceIdAmountint
Properties
Amount
public int Amount { get; init; }
Property Value
Resource
public ResourceId Resource { get; init; }
Property Value
Methods
FromString(string, int)
Creates a ResourceCost from a string resource ID.
public static ResourceCost FromString(string resourceId, int amount)
Parameters
Returns
Validate()
Validates that the amount is non-negative.
public ResourceCost Validate()
Returns
Operators
implicit operator ResourceCost((string Resource, int Amount))
Implicit conversion from tuple (string, int) to ResourceCost.
public static implicit operator ResourceCost((string Resource, int Amount) tuple)