|
@ -66,6 +66,23 @@ namespace SemiColinGames { |
|
|
Normal = normal; |
|
|
Normal = normal; |
|
|
Time = time; |
|
|
Time = time; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static bool operator ==(Hit a, Hit b) { |
|
|
|
|
|
return a.Position == b.Position && a.Delta == b.Delta && a.Normal == b.Normal |
|
|
|
|
|
&& a.Time == b.Time && a.Collider == b.Collider; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static bool operator !=(Hit a, Hit b) { |
|
|
|
|
|
return !(a == b); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object o) { |
|
|
|
|
|
return o is Hit h && this == h; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode() { |
|
|
|
|
|
return (Collider, Position, Delta, Normal, Time).GetHashCode(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public readonly struct Sweep { |
|
|
public readonly struct Sweep { |
|
@ -78,6 +95,22 @@ namespace SemiColinGames { |
|
|
Position = position; |
|
|
Position = position; |
|
|
Time = time; |
|
|
Time = time; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static bool operator ==(Sweep a, Sweep b) { |
|
|
|
|
|
return a.Hit == b.Hit && a.Position == b.Position && a.Time == b.Time; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static bool operator !=(Sweep a, Sweep b) { |
|
|
|
|
|
return !(a == b); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object o) { |
|
|
|
|
|
return o is Sweep s && this == s; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode() { |
|
|
|
|
|
return (Hit, Position, Time).GetHashCode(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public readonly struct AABB { |
|
|
public readonly struct AABB { |
|
@ -94,6 +127,22 @@ namespace SemiColinGames { |
|
|
Tile = tile; |
|
|
Tile = tile; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static bool operator ==(AABB a, AABB b) { |
|
|
|
|
|
return a.Position == b.Position && a.HalfSize == b.HalfSize && a.Tile == b.Tile; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static bool operator !=(AABB a, AABB b) { |
|
|
|
|
|
return !(a == b); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object o) { |
|
|
|
|
|
return o is AABB a && this == a; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode() { |
|
|
|
|
|
return (Position, HalfSize, Tile).GetHashCode(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public float Top { |
|
|
public float Top { |
|
|
get { return Position.Y - HalfSize.Y; } |
|
|
get { return Position.Y - HalfSize.Y; } |
|
|
} |
|
|
} |
|
|