-
Notifications
You must be signed in to change notification settings - Fork 0
/
Element.cs
67 lines (60 loc) · 1.28 KB
/
Element.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace My90Tank
{
/// <summary>
/// </summary>
public abstract class Element
{
private int x;
private int y;
private int width;
private int height;
public int X {
get{ return x;}
set{
if (value >= 0)
x = value;
else
x= 0;
}
}
public int Y
{
get { return y; }
set {
if (value >= 0)
y = value;
else
y = 0;
}
}
public int Width
{
get { return width; }
set { width = value; }
}
public int Height
{
get { return height; }
set { height = value; }
}
public Element(int x, int y)
{
this.x = x;
this.y = y;
}
public abstract void Draw(Graphics g);
public virtual Rectangle GetRectangle()
{
return new Rectangle(X, Y, Width, Height);
}
}
public enum DIRECTION
{
UP,DOWN,LEFT,RIGHT
}
}