-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmeny.cs
35 lines (31 loc) · 791 Bytes
/
Emeny.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
using System;
using System.Dynamic;
using Defenders;
namespace Enemies
{
abstract class Enemy
{
public string Name { get; }
public bool Alive { get; private set; }
public int HP { get; private set; }
protected Enemy(string name, int hp)
{
Name = name;
HP = hp;
Alive = true;
}
protected void GetDamage(int damage)
{
HP -= damage;
if (HP <= 0)
{
Console.WriteLine($"{Name} is dead...");
Alive = false;
}
}
public virtual void Approach(IDefender defender)
{
Console.WriteLine("Accesing Approach from base/parent class Enemy", Environment.NewLine);
}
}
}