-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVector2i.cs
51 lines (43 loc) · 1.08 KB
/
Vector2i.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System;
namespace MmorpgServer
{
public struct Vector2i : IEquatable<Vector2i>
{
public Int32 X;
public Int32 Y;
public Vector2i(Int32 x, Int32 y)
{
X = x;
Y = y;
}
public override int GetHashCode()
{
unchecked
{
return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();
}
}
public override bool Equals(object obj)
{
if (!(obj is Vector2i))
{
return false;
}
return this.Equals((Vector2i)obj);
}
public bool Equals(Vector2i other)
{
return
X == other.X &&
Y == other.Y;
}
public static bool operator ==(in Vector2i self, in Vector2i other)
{
return self.X == other.X && self.Y == other.Y;
}
public static bool operator !=(in Vector2i self, in Vector2i other)
{
return self.X != other.X || self.Y != other.Y;
}
}
}