-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathObstacle.cs
More file actions
45 lines (41 loc) · 1.21 KB
/
Obstacle.cs
File metadata and controls
45 lines (41 loc) · 1.21 KB
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
using System;
using System.Drawing;
namespace Sailing
{
struct Shape
{
public Point[] p;
public SolidBrush b;
public Shape(Point[] points) {
p = points;
b = new SolidBrush(Color.White);
}
public void Draw(Graphics g) { g.FillPolygon(b, p); }
}
abstract class Obstacle : Content
{
public static readonly Color shoalColor = Color.FromArgb(127,185,194);
public Shape s;
public Obstacle(ContentManager m, Point[] points): base(m) {
s = new Shape(points);
}
public override void Draw(Graphics g, float t) { s.Draw(g); }
}
class Land : Obstacle
{
static readonly Pen shoalPen = new Pen(Obstacle.shoalColor, 5f);
public Land(ContentManager m, Point[] p): base(m, p) {
s.b.Color = Color.FromArgb(170, 150, 80);
}
public override void Draw(Graphics g, float t) {
base.Draw(g, t);
g.DrawPolygon(shoalPen, s.p);
}
}
class Shoal : Obstacle
{
public Shoal(ContentManager m, Point[] p): base(m, p) {
s.b.Color = shoalColor;
}
}
}