PotatoPlan/Game1/Sources/Objects/FertilizerHolder.cs

181 lines
4.2 KiB
C#
Raw Normal View History

2020-05-10 01:38:08 +02:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class FertilizerHolder
{
private Fertilizer[] FertilizerType = new Fertilizer[8];
public void init()
{
/*
FertilizerType[0] = new Fertilizer
{
ID = 999,
Name = "None",
Nitrogen = 0.0f / 5,
Phosphorus = 0 * 0.436f / 5,
Potassium = 0 * 0.83f / 5
};
FertilizerType[1] = new Fertilizer
{
ID = 0,
Name = "10-26-26",
Nitrogen = 10.0f / 5,
Phosphorus = 26 * 0.436f / 5,
Potassium = 26 * 0.83f / 5
};
FertilizerType[2] = new Fertilizer
{
ID = 1,
Name = "14-35-14",
Nitrogen = 14.0f / 5,
Phosphorus = 35 * 0.436f / 5,
Potassium = 14 * 0.83f / 5
};
FertilizerType[3] = new Fertilizer
{
ID = 2,
Name = "17-17-17",
Nitrogen = 17.0f / 5,
Phosphorus = 17 * 0.436f / 5,
Potassium = 17 * 0.83f / 5
};
FertilizerType[4] = new Fertilizer
{
ID = 3,
Name = "20-20",
Nitrogen = 20.0f / 5,
Phosphorus = 20 * 0.436f / 5,
Potassium = 0 * 0.83f / 5
};
FertilizerType[5] = new Fertilizer
{
ID = 4,
Name = "28-28",
Nitrogen = 28.0f / 5,
Phosphorus = 28 * 0.436f / 5,
Potassium = 0 * 0.83f / 5
};
FertilizerType[6] = new Fertilizer
{
ID = 5,
Name = "DAP",
Nitrogen = 18.0f / 5,
Phosphorus = 46 * 0.436f / 5,
Potassium = 0 * 0.83f / 5
};
FertilizerType[7] = new Fertilizer
{
ID = 6,
Name = "Urea",
Nitrogen = 46.0f / 5,
Phosphorus = 0 * 0.436f / 5,
Potassium = 0 * 0.83f / 5
};
}
*/
FertilizerType[0] = new Fertilizer
{
ID = 999,
Name = "None",
Nitrogen = 0.0f / 5,
Phosphorus = 0 * 0.436f / 5,
Potassium = 0 * 0.83f / 5
};
FertilizerType[1] = new Fertilizer
{
ID = 0,
Name = "10-26-26",
2020-05-10 12:55:13 +02:00
Nitrogen = 17.21f / 5,
Phosphorus = 12.14f / 5,
Potassium = 0.64f / 5
2020-05-10 01:38:08 +02:00
};
FertilizerType[2] = new Fertilizer
{
ID = 1,
Name = "14-35-14",
2020-05-10 12:55:13 +02:00
Nitrogen = 16.89f / 5,
Phosphorus = 6.21f / 5,
Potassium = 5.21f / 5
2020-05-10 01:38:08 +02:00
};
FertilizerType[3] = new Fertilizer
{
ID = 2,
Name = "17-17-17",
2020-05-10 12:55:13 +02:00
Nitrogen = 14.92f / 5,
Phosphorus = 14.42f / 5,
Potassium = 3.0f / 5
2020-05-10 01:38:08 +02:00
};
FertilizerType[4] = new Fertilizer
{
ID = 3,
Name = "20-20",
2020-05-10 12:55:13 +02:00
Nitrogen = 15.39f / 5,
Phosphorus = 15.21f / 5,
Potassium = 9.5f / 5
2020-05-10 01:38:08 +02:00
};
FertilizerType[5] = new Fertilizer
{
ID = 4,
Name = "28-28",
2020-05-10 12:55:13 +02:00
Nitrogen = 9.67f / 5,
Phosphorus = 10.47f / 5,
Potassium = 9.5f / 5
2020-05-10 01:38:08 +02:00
};
FertilizerType[6] = new Fertilizer
{
ID = 5,
Name = "DAP",
2020-05-10 12:55:13 +02:00
Nitrogen = 14.52f / 5,
Phosphorus = 1.77f / 5,
Potassium = 9.5f / 5
2020-05-10 01:38:08 +02:00
};
FertilizerType[7] = new Fertilizer
{
ID = 6,
Name = "Urea",
2020-05-10 12:55:13 +02:00
Nitrogen = 1.81f / 5,
Phosphorus = 21.0f / 5,
Potassium = 9.5f / 5
2020-05-10 01:38:08 +02:00
};
}
public int GetFertilizerID(string name)
{
foreach (Fertilizer fertilizer in FertilizerType)
{
if (fertilizer.Name == name)
return fertilizer.ID;
}
return 0;
}
public Fertilizer GetFertilizer(string name)
{
foreach (Fertilizer fertilizer in FertilizerType)
{
if (fertilizer.Name == name)
return fertilizer;
}
return FertilizerType[0];
}
}