From 7fd69946fe8069229a456aeee57876b3ca3cf69c Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 6 May 2020 21:52:30 +0200 Subject: [PATCH] CropTypes --- Game1/Game1.cs | 2 +- Game1/Game1.csproj | 2 + Game1/Sources/Crops/CropType.cs | 20 ++++ Game1/Sources/Crops/CropTypesHolder.cs | 147 +++++++++++++++++++++++++ Game1/Sources/Crops/Farm.cs | 1 + 5 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 Game1/Sources/Crops/CropType.cs create mode 100644 Game1/Sources/Crops/CropTypesHolder.cs diff --git a/Game1/Game1.cs b/Game1/Game1.cs index e028e85..eb3a5f7 100644 --- a/Game1/Game1.cs +++ b/Game1/Game1.cs @@ -168,7 +168,7 @@ namespace Game1 for (int i = 0; i < 5; i++) { - spriteBatch.Draw(ProgressionBar, new Rectangle(i * 227, (int)(input.getSize().Y * (input.getTileSize() + input.getSpacing())), 5, 300), Color.White); + spriteBatch.Draw(ProgressionBar, new Rectangle(i * 227, (int)(input.getSize().Y * (input.getTileSize() + input.getSpacing())), 5, 295), Color.White); } for (int i = 0; i < 15; i++) { diff --git a/Game1/Game1.csproj b/Game1/Game1.csproj index ba120d6..218552a 100644 --- a/Game1/Game1.csproj +++ b/Game1/Game1.csproj @@ -67,6 +67,8 @@ + + diff --git a/Game1/Sources/Crops/CropType.cs b/Game1/Sources/Crops/CropType.cs new file mode 100644 index 0000000..07faf17 --- /dev/null +++ b/Game1/Sources/Crops/CropType.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + + +class CropTypes +{ + public string[] soilType; + public int[] Times; + public float Temparature; + public float Humidity; + public float Moisture; + public float Nitrogen; + public float Potassium; + public float Phosphorous; +} + diff --git a/Game1/Sources/Crops/CropTypesHolder.cs b/Game1/Sources/Crops/CropTypesHolder.cs new file mode 100644 index 0000000..4419ea0 --- /dev/null +++ b/Game1/Sources/Crops/CropTypesHolder.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + + +class CropTypesHolder +{ + private CropTypes[] cropTypes = new CropTypes[11]; + + public void init() + { + // Barley + cropTypes[0].soilType[0] = "Sandy"; + cropTypes[0].soilType[1] = null; + cropTypes[0].soilType[2] = null; + cropTypes[0].Temparature = 30.1f; + cropTypes[0].Humidity = 59.0f; + cropTypes[0].Moisture = 41.7f; + cropTypes[0].Nitrogen = 12.6f; + cropTypes[0].Potassium = 5.3f; + cropTypes[0].Phosphorous = 26.0f; + + + // Cotton + cropTypes[1].soilType[0] = "Red"; + cropTypes[1].Times[0] = 5; + cropTypes[1].soilType[1] = "Black"; + cropTypes[1].Times[1] = 4; + cropTypes[1].soilType[2] = "Loamy"; + cropTypes[1].Times[2] = 3; + cropTypes[1].Temparature = 30.4f; + cropTypes[1].Humidity = 59.6f; + cropTypes[1].Moisture = 63.2f; + cropTypes[1].Nitrogen = 16.4f; + cropTypes[1].Potassium = 3.3f; + cropTypes[1].Phosphorous = 23.8f; + + // Ground Nuts + cropTypes[2].soilType[0] = "Red"; + cropTypes[2].soilType[1] = null; + cropTypes[2].soilType[2] = null; + cropTypes[2].Temparature = 30.1f; + cropTypes[2].Humidity = 59.1f; + cropTypes[2].Moisture = 33.1f; + cropTypes[2].Nitrogen = 23.3f; + cropTypes[2].Potassium = 2.0f; + cropTypes[2].Phosphorous = 21.6f; + + + // Maize + cropTypes[3].soilType[0] = "Sandy"; + cropTypes[3].soilType[1] = null; + cropTypes[3].soilType[2] = null; + cropTypes[3].Temparature = 29.0f; + cropTypes[3].Humidity = 57.3f; + cropTypes[3].Moisture = 42.2f; + cropTypes[3].Nitrogen = 18.3f; + cropTypes[3].Potassium = 5.7f; + cropTypes[3].Phosphorous = 18.7f; + + // Millets + cropTypes[4].soilType[0] = "Sandy"; + cropTypes[4].Times[0] = 7; + cropTypes[4].soilType[1] = "Black"; + cropTypes[4].Times[0] = 4; + cropTypes[4].soilType[2] = null; + cropTypes[4].Temparature = 29.5f; + cropTypes[4].Humidity = 57.3f; + cropTypes[4].Moisture = 38.5f; + cropTypes[4].Nitrogen = 23.2f; + cropTypes[4].Potassium = 0; + cropTypes[4].Phosphorous = 14.4f; + + //Oil Seeds + cropTypes[5].soilType[0] = "Black"; + cropTypes[5].soilType[1] = null; + cropTypes[5].soilType[2] = null; + cropTypes[5].Temparature = 30.3f; + cropTypes[5].Humidity = 59.1f; + cropTypes[5].Moisture = 32.1f; + cropTypes[5].Nitrogen = 19.0f; + cropTypes[5].Potassium = 2.3f; + cropTypes[5].Phosphorous = 17.3f; + + //Paddys + cropTypes[6].soilType[0] = "Clayey"; + cropTypes[6].soilType[1] = null; + cropTypes[6].soilType[2] = null; + cropTypes[6].Temparature = 31.2f; + cropTypes[6].Humidity = 60.4f; + cropTypes[6].Moisture = 41.5f; + cropTypes[6].Nitrogen = 20.8f; + cropTypes[6].Potassium = 3.7f; + cropTypes[6].Phosphorous = 16.3f; + + //Pulses + cropTypes[7].soilType[0] = "Clayey"; + cropTypes[7].soilType[1] = null; + cropTypes[7].soilType[2] = null; + cropTypes[7].Temparature = 27.8f; + cropTypes[7].Humidity = 54.9f; + cropTypes[7].Moisture = 34.1f; + cropTypes[7].Nitrogen = 18.4f; + cropTypes[7].Potassium = 4.2f; + cropTypes[7].Phosphorous = 17.5f; + + //Sugarcane + cropTypes[8].soilType[0] = "Loamy"; + cropTypes[8].Times[0] = 9; + cropTypes[8].soilType[1] = "Black"; + cropTypes[8].Times[0] = 4; + cropTypes[8].soilType[2] = null; + cropTypes[8].Temparature = 30.0f; + cropTypes[8].Humidity = 58.6f; + cropTypes[8].Moisture = 51.2f; + cropTypes[8].Nitrogen = 14.6f; + cropTypes[8].Potassium = 4.2f; + cropTypes[8].Phosphorous = 17.6f; + + + //Tobacco + cropTypes[9].soilType[0] = "Red"; + cropTypes[9].soilType[1] = null; + cropTypes[9].soilType[2] = null; + cropTypes[9].Temparature = 31.9f; + cropTypes[9].Humidity = 62.4f; + cropTypes[9].Moisture = 31.6f; + cropTypes[9].Nitrogen = 19.1f; + cropTypes[9].Potassium = 4.9f; + cropTypes[9].Phosphorous = 19.3f; + + + //Wheat + cropTypes[10].soilType[0] = "Loamy"; + cropTypes[10].soilType[1] = null; + cropTypes[10].soilType[2] = null; + cropTypes[10].Temparature = 33.1f; + cropTypes[10].Humidity = 63.8f; + cropTypes[10].Moisture = 50.0f; + cropTypes[10].Nitrogen = 23.3f; + cropTypes[10].Potassium = 2.9f; + cropTypes[10].Phosphorous = 14.4f; + + } +} diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs index 6f04ee8..f31b32e 100644 --- a/Game1/Sources/Crops/Farm.cs +++ b/Game1/Sources/Crops/Farm.cs @@ -10,6 +10,7 @@ class Farm { private Crops[,] crops; private Random r; + //initializes the crops public void init(Vector2 Size, Vector2 housepos)