1
0
forked from s425077/PotatoPlan
PotatoPlan/Game1/Sources/Objects/FertilizerHolder.cs
2020-05-24 01:57:27 +02:00

181 lines
4.2 KiB
C#

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 / 2,
Phosphorus = 0 * 0.436f / 2,
Potassium = 0 * 0.83f / 2
};
FertilizerType[1] = new Fertilizer
{
ID = 0,
Name = "10-26-26",
Nitrogen = 10.0f / 2,
Phosphorus = 26 * 0.436f / 2,
Potassium = 26 * 0.83f / 2
};
FertilizerType[2] = new Fertilizer
{
ID = 1,
Name = "14-35-14",
Nitrogen = 14.0f / 2,
Phosphorus = 35 * 0.436f / 2,
Potassium = 14 * 0.83f / 2
};
FertilizerType[3] = new Fertilizer
{
ID = 2,
Name = "17-17-17",
Nitrogen = 17.0f / 2,
Phosphorus = 17 * 0.436f / 2,
Potassium = 17 * 0.83f / 2
};
FertilizerType[4] = new Fertilizer
{
ID = 3,
Name = "20-20",
Nitrogen = 20.0f / 2,
Phosphorus = 20 * 0.436f / 2,
Potassium = 0 * 0.83f / 2
};
FertilizerType[5] = new Fertilizer
{
ID = 4,
Name = "28-28",
Nitrogen = 28.0f / 2,
Phosphorus = 28 * 0.436f / 2,
Potassium = 0 * 0.83f / 2
};
FertilizerType[6] = new Fertilizer
{
ID = 5,
Name = "DAP",
Nitrogen = 18.0f / 2,
Phosphorus = 46 * 0.436f / 2,
Potassium = 0 * 0.83f / 2
};
FertilizerType[7] = new Fertilizer
{
ID = 6,
Name = "Urea",
Nitrogen = 46.0f / 2,
Phosphorus = 0 * 0.436f / 2,
Potassium = 0 * 0.83f / 2
};
}
*/
FertilizerType[0] = new Fertilizer
{
ID = 999,
Name = "None",
Nitrogen = 0.0f / 2,
Phosphorus = 0 * 0.436f / 2,
Potassium = 0 * 0.83f / 2
};
FertilizerType[1] = new Fertilizer
{
ID = 0,
Name = "10-26-26",
Nitrogen = 17.21f / 2,
Phosphorus = 12.14f / 2,
Potassium = 0.64f / 2
};
FertilizerType[2] = new Fertilizer
{
ID = 1,
Name = "14-35-14",
Nitrogen = 16.89f / 2,
Phosphorus = 6.21f / 2,
Potassium = 5.21f / 2
};
FertilizerType[3] = new Fertilizer
{
ID = 2,
Name = "17-17-17",
Nitrogen = 14.92f / 2,
Phosphorus = 14.42f / 2,
Potassium = 3.0f / 2
};
FertilizerType[4] = new Fertilizer
{
ID = 3,
Name = "20-20",
Nitrogen = 15.39f / 2,
Phosphorus = 15.21f / 2,
Potassium = 9.5f / 2
};
FertilizerType[5] = new Fertilizer
{
ID = 4,
Name = "28-28",
Nitrogen = 9.67f / 2,
Phosphorus = 10.47f / 2,
Potassium = 9.5f / 2
};
FertilizerType[6] = new Fertilizer
{
ID = 5,
Name = "DAP",
Nitrogen = 14.52f / 2,
Phosphorus = 1.77f / 2,
Potassium = 9.5f / 2
};
FertilizerType[7] = new Fertilizer
{
ID = 6,
Name = "Urea",
Nitrogen = 1.81f / 2,
Phosphorus = 21.0f / 2,
Potassium = 9.5f / 2
};
}
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];
}
}