-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tower.cs
72 lines (64 loc) · 1.67 KB
/
Tower.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
namespace SQA_Tower_Defense
{
class Tower
{
protected Texture2D towerImage;
protected String name;
protected Vector2 location;
protected int health;
protected int attackDamage;
protected int cost;
protected int range;
protected List<Enemy> nearbyEnemies;
public Tower(Texture2D towerImage, String name, int health, int damage,
int cost, int range, Vector2 location)
{
this.towerImage = towerImage;
this.name = name;
this.health = health;
this.attackDamage = damage;
this.cost = cost;
this.range = range;
this.location = location;
}
public void AddNearbyEnemy(Enemy enemy)
{
nearbyEnemies.Add(enemy);
}
public void AttackEnemy()
{
if(nearbyEnemies.Count > 0)
nearbyEnemies[0].Health -= this.attackDamage;
}
public int Health
{
get { return this.health; }
}
public int AttackDamage
{
get { return this.attackDamage; }
}
public int Cost
{
get { return this.cost; }
}
public int Range
{
get { return this.range; }
}
public Texture2D Image
{
get { return this.towerImage; }
}
public String Name
{
get { return this.name; }
}
}
}