Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion RhythmGameUtilities/Structs/Note.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using System.Runtime.InteropServices;

namespace RhythmGameUtilities
{

[StructLayout(LayoutKind.Sequential)]
public struct Note
public struct Note : IEquatable<Note>
{

public int Position;
Expand All @@ -13,6 +14,28 @@ public struct Note

public int Length;

public override int GetHashCode() => (Position, HandPosition, Length).GetHashCode();

public bool Equals(Note other)
{
return Position == other.Position && HandPosition == other.HandPosition && Length == other.Length;
}

public override bool Equals(object obj)
{
return obj is Note other && Equals(other);
}

public static bool operator ==(Note left, Note right)
{
return left.Equals(right);
}

public static bool operator !=(Note left, Note right)
{
return !(left == right);
}

}

}
25 changes: 24 additions & 1 deletion UnityPackage/Structs/Note.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using System.Runtime.InteropServices;

namespace RhythmGameUtilities
{

[StructLayout(LayoutKind.Sequential)]
public struct Note
public struct Note : IEquatable<Note>
{

public int Position;
Expand All @@ -13,6 +14,28 @@ public struct Note

public int Length;

public override int GetHashCode() => (Position, HandPosition, Length).GetHashCode();

public bool Equals(Note other)
{
return Position == other.Position && HandPosition == other.HandPosition && Length == other.Length;
}

public override bool Equals(object obj)
{
return obj is Note other && Equals(other);
}

public static bool operator ==(Note left, Note right)
{
return left.Equals(right);
}

public static bool operator !=(Note left, Note right)
{
return !(left == right);
}

}

}
Loading