Struct ValidationComponent
- Namespace
- MoonBark.GridPlacement.Core.Interfaces
- Assembly
- MoonBark.GridPlacement.Core.dll
Pure domain validation component for placement validation results. No ECS dependencies.
public readonly struct ValidationComponent : IEquatable<ValidationComponent>
- Implements
- Inherited Members
Constructors
ValidationComponent(bool, string, long, CoreVector2I)
public ValidationComponent(bool isValid, string reasonCode = "ok", long timestamp = 0, CoreVector2I position = default)
Parameters
Properties
IsValid
public bool IsValid { get; init; }
Property Value
LastValidatedPosition
public CoreVector2I LastValidatedPosition { get; init; }
Property Value
- CoreVector2I
LastValidatedTimestamp
public long LastValidatedTimestamp { get; init; }
Property Value
ReasonCode
public string ReasonCode { get; init; }
Property Value
Methods
Equals(ValidationComponent)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(ValidationComponent other)
Parameters
otherValidationComponentAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
Invalid(string, long, CoreVector2I)
public static ValidationComponent Invalid(string reason, long timestamp = 0, CoreVector2I position = default)
Parameters
Returns
Valid(long, CoreVector2I)
public static ValidationComponent Valid(long timestamp = 0, CoreVector2I position = default)
Parameters
timestamplongpositionCoreVector2I
Returns
Operators
operator ==(ValidationComponent, ValidationComponent)
public static bool operator ==(ValidationComponent left, ValidationComponent right)
Parameters
leftValidationComponentrightValidationComponent
Returns
operator !=(ValidationComponent, ValidationComponent)
public static bool operator !=(ValidationComponent left, ValidationComponent right)
Parameters
leftValidationComponentrightValidationComponent