/// <summary>
/// 상속구조를 통해 정의하는 방법
/// </summary>
public record InteractType
{
public static readonly InteractType Interact = new InteractType("Interact");
public override string ToString()
{
return this.Value;
}
public InteractType(string value) => this.Value = value;
public string Value { get; private set; }
}
public sealed record InteractTypeDerived : InteractType
{
public static readonly InteractType Breakable = new InteractType("interact");
public InteractTypeDerived(string value) : base(value) { }
}
/// <summary>
/// 해당 클래스 & 구조체를 분할해서 정의하는 방법
/// </summary>
internal partial struct InteractType
{
public static readonly InteractType Interact = new InteractType("Interact");
public static bool operator ==(InteractType lhs, InteractType rhs) => lhs.Value.Equals(rhs.Value);
public static bool operator !=(InteractType lhs, InteractType rhs) => !(lhs == rhs);
public InteractType(in string value) => this.Value = value;
public string Value { get; private set; }
public override bool Equals(object obj)
{
return base.Equals(obj);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
public override string ToString()
{
return base.ToString();
}
}
internal partial struct InteractType
{
public static readonly InteractType Breakable = new InteractType("Breakable");
}