This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
NG_2023_Stanislav_Mykhailenko/Lesson_4/Task_2/Classes/Magic.cs

35 lines
769 B
C#
Raw Normal View History

2023-04-09 18:00:28 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2023-04-10 15:31:36 +00:00
using Open_Closed.Interfaces;
namespace Open_Closed.Classes
2023-04-09 18:00:28 +00:00
{
2023-04-11 20:29:05 +00:00
public class Magic : IMagic
2023-04-09 18:00:28 +00:00
{
2023-04-13 15:16:26 +00:00
private List<MagicType> MagicTypes;
public Magic(List<MagicType> magicTypes)
2023-04-09 18:00:28 +00:00
{
2023-04-13 15:16:26 +00:00
MagicTypes = magicTypes;
}
public void CountYourMagic(int magic)
{
foreach(var magicType in MagicTypes)
{
if(magic == magicType.Value)
{
Console.WriteLine($"Wow, your magic is {magicType.Name}!");
return;
}
}
Console.WriteLine("I understand you...");
2023-04-09 18:00:28 +00:00
}
}
}