-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
52 lines (43 loc) · 2.24 KB
/
Program.cs
File metadata and controls
52 lines (43 loc) · 2.24 KB
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
using System;
using System.Threading;
namespace State
{
internal class Program
{
static void Main(string[] args)
{
Console.OutputEncoding = System.Text.Encoding.UTF8;
Enemy goblin = new Enemy("Гоблин", 100, 5, 2, 20, 2);
Player hero = new Player("Jon", 100, 4, 4);
Console.WriteLine("=== Игровая сессия началась ===");
Console.WriteLine($"Враг: {goblin.Name} (Здоровье: {goblin.Health})");
Console.WriteLine($"Игрок: {hero.Name} (Здоровье: {hero.Health})");
Console.WriteLine($"Начальная позиция игрока: ({hero.X}, {hero.Y})");
Console.WriteLine($"Начальная позиция врага: ({goblin.X}, {goblin.Y})");
Console.WriteLine("================================\n");
for (int i = 0; i < 10; i++)
{
Console.WriteLine($"\n--- Итерация {i + 1} ---");
goblin.Update(hero);
float distance = hero.GetDistanceTo(goblin);
Console.WriteLine($"Игрок: ({hero.X:F1}, {hero.Y:F1}) | Враг: ({goblin.X:F1}, {goblin.Y:F1})");
Console.WriteLine($"Расстояние до игрока: {distance:F2}");
Console.WriteLine($"Текущее состояние врага: {goblin.CurrentStateName()}");
Thread.Sleep(1500);
if (i % 3 == 0 && i < 10 && hero.Health > 0)
{
float newX = hero.X - 1;
float newY = hero.Y - 1;
hero.MoveTo(newX, newY);
Console.WriteLine($"Игрок переместился на ({newX:F1}, {newY:F1})");
}
else if (i == 10)
{
Console.WriteLine("\n=== Игровая сессия завершена ===");
Console.WriteLine($"Итоговое здоровье игрока: {hero.Health}");
Console.WriteLine($"Итоговое здоровье врага: {goblin.Health}");
}
}
}
}
}