Table of Contents

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

Resource ResourceId
Amount int

Properties

Amount

public int Amount { get; init; }

Property Value

int

Resource

public ResourceId Resource { get; init; }

Property Value

ResourceId

Methods

FromString(string, int)

Creates a ResourceCost from a string resource ID.

public static ResourceCost FromString(string resourceId, int amount)

Parameters

resourceId string
amount int

Returns

ResourceCost

Validate()

Validates that the amount is non-negative.

public ResourceCost Validate()

Returns

ResourceCost

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)

Parameters

tuple (string Resource, int Amount)

Returns

ResourceCost