-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathCollidableRectangle.cs
74 lines (65 loc) · 1.64 KB
/
CollidableRectangle.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using Microsoft.Xna.Framework;
namespace Hacknet
{
public struct CollidableRectangle
{
private static readonly CollidableRectangle z = new CollidableRectangle(0.0f, 0.0f, Vector2.Zero);
public Vector2 position;
private float b_width;
private float b_height;
public Rectangle ck;
public static CollidableRectangle Zero
{
get { return z; }
}
public Vector2 pos
{
get { return position; }
set
{
position = value;
ck.X = (int) pos.X;
ck.Y = (int) pos.Y;
}
}
public float Width
{
get { return b_width; }
set
{
b_width = value;
ck.Width = (int) value;
}
}
public float Height
{
get { return b_height; }
set
{
b_height = value;
ck.Height = (int) value;
}
}
public Rectangle checkable
{
get { return ck; }
}
public CollidableRectangle(float w, float h, Vector2 p)
{
b_width = w;
b_height = h;
position = p;
ck = new Rectangle();
}
public override bool Equals(object obj)
{
if (!(obj is CollidableRectangle))
return false;
return ((CollidableRectangle) obj).checkable.Equals(checkable);
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}