-
Notifications
You must be signed in to change notification settings - Fork 0
/
Move.cs
54 lines (43 loc) · 963 Bytes
/
Move.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
using System;
namespace diese
{
public abstract class Operation
{
}
public class Move : Operation
{
public double Length;
public double X;
public double Y;
public Move()
{
}
public Move(int dx, int dy)
{
Length = Math.Sqrt(dx * dx + dy * dy);
X = dx / Length;
Y = dy / Length;
}
public void Shorten(int dl)
{
Length = Math.Max(0, Length - dl);
}
}
public class Shot : Operation
{
public int X;
public int Y;
public double Angle;
public double Length;
public bool HasShot;
public Shot()
{
HasShot = false;
Length = 20;
}
public void Shorten(int dt)
{
Length = Math.Max(0, Length - dt);
}
}
}