-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBulk.cs
85 lines (71 loc) · 2.11 KB
/
Bulk.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
75
76
77
78
79
80
81
82
83
84
85
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows.Shapes;
namespace Bulkes
{
class Bulk : Unit
{
protected bool isMoved;
protected float mass;
protected Indicator indicator;
public Bulk(float _x, float _y, float _radius, Color _color) : base (_x, _y, _radius, _color)
{
mass = (float)Math.PI * _radius * _radius;
isMoved = false;
indicator = new Indicator();
animationRadius = radius;
}
public Bulk(float _x, float _y, float _radius) : this(_x, _y, _radius, Settings.BulkDefaultColor)
{ }
public float getSpeedCoefficient()
{
return Math.Min(Settings.BulkBaseSize / radius, 2f);
}
public override float getSpeedX()
{
return speedX * getSpeedCoefficient();
}
public override float getSpeedY()
{
return speedY * getSpeedCoefficient();
}
public bool getIsMoved()
{
return isMoved;
}
public void setIsMoved(bool flag)
{
isMoved = flag;
}
public void addMass(float feed)
{
setMass(feed + mass);
}
public float getMass()
{
return mass;
}
public void setMass(float mass)
{
this.mass = mass;
radius = (float)Math.Sqrt((double)mass / Math.PI) * Settings.UserScale;
baseRadius = radius;
}
public override void updatePosition(Unit unit)//update location + radius
{
radius = (float)Math.Sqrt((double)mass / Math.PI) * Settings.UserScale;
x = unit.getX() + ((baseX - unit.getX()) * Settings.UserScale);
y = unit.getY() + ((baseY - unit.getY()) * Settings.UserScale);
if (!isOnMainScreen())
animationRadius = radius;
}
public override float getFeed()
{
return mass;
}
}
}