-
Notifications
You must be signed in to change notification settings - Fork 0
/
TDExplosion.cs
39 lines (34 loc) · 976 Bytes
/
TDExplosion.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
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace TowerDefense
{
public class TDExplosion
{
public bool DeleteMe = false;
public TDLocation Location;
public int Radius;
DateTime Spawn;
TimeSpan Duration = new TimeSpan(0,0,0,0,200);
Pen ExplosionPen = new Pen(new SolidBrush(Color.Yellow), 3);
public TDExplosion(TDLocation loc, int radius)
{
this.Location = new TDLocation(loc.X, loc.Y);
this.Radius = radius;
this.Spawn = DateTime.Now;
}
public void Update()
{
if (DateTime.Now > Spawn + Duration)
{
DeleteMe = true;
}
}
public void DrawSelf(Graphics g)
{
g.DrawEllipse(ExplosionPen, (int)(Location.X - Radius/2), (int)(Location.Y - Radius/2), Radius, Radius);
}
}
}