From 5e907deca7c457bae73969c035da79a04ee853a1 Mon Sep 17 00:00:00 2001 From: Joel Date: Sun, 24 May 2020 21:00:24 +0200 Subject: [PATCH] asd --- Game1/Content/Content.mgcb | 12 ++++ Game1/Content/WoodBackground.png | Bin 0 -> 30730 bytes Game1/Game1.cs | 51 +++++++++------ Game1/Sources/Crops/CropType.cs | 4 ++ Game1/Sources/Crops/CropTypesHolder.cs | 59 ++++++++++++++++++ Game1/Sources/Crops/Crops.cs | 59 ++++++++++-------- Game1/Sources/Crops/Farm.cs | 54 ++++++++-------- Game1/Sources/Crops/SoilProperties.cs | 2 + Game1/Sources/Objects/DayNightCycle.cs | 48 +++++++++----- .../Objects/InventorySystem/Inventory.cs | 8 +-- Game1/Sources/Objects/Tractor.cs | 2 +- Game1/Sources/Smart/SmartTractor.cs | 5 +- 12 files changed, 210 insertions(+), 94 deletions(-) create mode 100644 Game1/Content/WoodBackground.png diff --git a/Game1/Content/Content.mgcb b/Game1/Content/Content.mgcb index d4166f8..fc15b7d 100644 --- a/Game1/Content/Content.mgcb +++ b/Game1/Content/Content.mgcb @@ -404,3 +404,15 @@ /processorParam:TextureFormat=Color /build:WheatIcon.png +#begin WoodBackground.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:WoodBackground.png + diff --git a/Game1/Content/WoodBackground.png b/Game1/Content/WoodBackground.png new file mode 100644 index 0000000000000000000000000000000000000000..5f924f24c3dced59125b6531aaf8727ba40661dc GIT binary patch literal 30730 zcmeHv3pkYN|Mz2sO3}8(wk0}jB#iT6FheJ)m_#|0!#GVU#$gy?X2^D;rIIKyb~~t~ zsR%i%WTPlTau_+RhL{|tVUF+p&}nUJ`ThRy|GnPp(sj+6=eeKz^tr$H_xt&L?`P-4 z4okE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P(MgX8Bz|YKwnQ-0s@X$D=3c0&wU#AO;_L2D4i5=*M`yD11#h zjU}>MU@@*A$5V_-?dEjoB%R#BlC2cFkyGuE*Y#3nJ)LsK>7yrsL{Er1$((+AEG!{@u}vOvbRJFO`x&&V)P)YtbIgG?Et_S1Rc z1swZax?F2MSX}QZmv-sho@$QeVl!-74VJMfgMG|=o1}U_RD2F&3nVX%=cZV0_94x7 zT=$msS+um~Qxer-jbZ{m|0YhsTY2r=eCe&r!ggLV$d^oz+Iq9vb?@LD`Qjo6nmWqG z8tte=(Sx)E!kUn?{>mwfS~=a@y3gh~g-@3$8jq~*8vy1cM)T1#+_UH{YEIajvmn zV{jhjRBDlNT?k)0zN$jEqR15-4a%ktB3}E%oE5qP${AKO_oo8zdLdXvJQ&AK0xbR5 z(_jHWmcZ}J(ct&x;?cK3CI!3@@!J(V9>k_H*~^(WiW#icRfHHM5see{x*0$9Fqcx|L)>lRo@#0JMM@E-{6BWrA#9vSsB9~`wy&=!99D=|yXd52(J)OeTN+-UpCAZ}q?cZuK1-LSQ$nfpkhiL% z@I9a2R6;U;SRgzcDGbv`&#JL{f4g&Ocq0=WSHA>rq?!vU!&6@OU?fNw1)pjBbVN2F z#!$NVJ9vSQG;qj|&rm8VWhHMS!txj_(CtFGE9Hh`Y*abv?D>@H>(Z~cSL1pGGR)h9 zRKmyYT%9&Z1sQpMnAG%NsO%-w`+bqbIxNhbi&T^1xB99FOg7yr2Bu z>VwU=E*^V#6ue)!Lts-ebwxO~*QIWw3@kSrmtQL2N^x!_aX4u{?@fC%>2F-Y>pzF1 zGW+pNodt3(4}d&|Jx9Fo("Clouds"); - + Background = Content.Load("WoodBackground"); Crops[0] = Content.Load("Markers"); @@ -195,46 +196,56 @@ namespace Game1 + + + for (int i = 0; i < 5; i++) { - spriteBatch.Draw(tile[0], new Rectangle(i * 227, (int)(input.getSize().Y * (input.getTileSize() + input.getSpacing())), 5, 350), Color.White); + for (int j = 0; j < 5; j++) + { + spriteBatch.Draw(Background, new Rectangle(i * 512, (int)input.getSize().Y * (input.getTileSize() + input.getSpacing()) + j * 512, 512, 512), Color.FromNonPremultiplied(125, 125, 125, 255)); + } } - for (int i = 0; i < 17; i++) + + for (int i = 0; i < 5; i++) + { + spriteBatch.Draw(tile[0], new Rectangle(i * 227, (int)(input.getSize().Y * (input.getTileSize() + input.getSpacing())), 5, 500), Color.White); + } + for (int i = 0; i < 20; i++) { spriteBatch.Draw(tile[0], new Rectangle(0, (int)(input.getSize().Y * (input.getTileSize() + input.getSpacing())) + i * 20, (int)(input.getSize().X * (input.getTileSize() + input.getSpacing())), 1), Color.White); } + tractorUnit.drawInventory(input, spriteBatch, Bold, inventory.getPredefinedItems()); spriteBatch.DrawString(Bold, "Time: ", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed); - spriteBatch.DrawString(Bold, "Days " + Time.getDays(), new Vector2(60, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Days " + Time.getDays(), new Vector2(60, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.Teal); spriteBatch.DrawString(Bold, "Day Progression: ", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 22), Color.DarkRed); - spriteBatch.DrawString(Bold, Time.GetTimeOfDayInt().ToString() + "%", new Vector2(140, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 22), Color.DarkBlue); + spriteBatch.DrawString(Bold, Time.GetTimeOfDayInt().ToString() + "%", new Vector2(140, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 22), Color.Teal); spriteBatch.DrawString(Bold, "Tractor Properties:", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 62), Color.DarkRed); - spriteBatch.DrawString(Bold, "Speed:" + tractorUnit.getSpeed().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 82) , Color.DarkBlue); - spriteBatch.DrawString(Bold, "Tractor Position:" + new Vector2((float)Math.Round(tractorUnit.getPos().X / input.getSpacingTile(), 1), (float)Math.Round(tractorUnit.getPos().Y / input.getSpacingTile(), 1)), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 102), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Tractor Rotation:" + Math.Round(tractorUnit.getRotation(), 2).ToString() + " Degrees", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 122), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Tractor Speed:" + tractorUnit.getTractorSpeed().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 142), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Tractor Target:" + tractorUnit.getPath().getFinalDest().getCords().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 162), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Speed:" + tractorUnit.getSpeed().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 82), Color.Teal); + spriteBatch.DrawString(Bold, "Tractor Position:" + new Vector2((float)Math.Round(tractorUnit.getPos().X / input.getSpacingTile(), 1), (float)Math.Round(tractorUnit.getPos().Y / input.getSpacingTile(), 1)), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 102), Color.Teal); + spriteBatch.DrawString(Bold, "Tractor Rotation:" + Math.Round(tractorUnit.getRotation(), 2).ToString() + " Degrees", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 122), Color.Teal); + spriteBatch.DrawString(Bold, "Tractor Speed:" + tractorUnit.getTractorSpeed().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 142), Color.Teal); + spriteBatch.DrawString(Bold, "Tractor Target:" + tractorUnit.getPath().getFinalDest().getCords().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 162), Color.Teal); spriteBatch.DrawString(Bold, "Map Properties:", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 202), Color.DarkRed); - spriteBatch.DrawString(Bold, "Tile Size:" + input.getTileSize().ToString() + "pix", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 222), Color.DarkBlue); //Draws the tile size - spriteBatch.DrawString(Bold, "Matrix Size: " + input.getSize().X.ToString() + " X " + input.getSize().Y.ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 242), Color.DarkBlue); - spriteBatch.DrawString(Bold, "House Position: " + houseUnit.getVector() / input.getSpacingTile(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 262), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Tile Size:" + input.getTileSize().ToString() + "pix", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 222), Color.Teal); //Draws the tile size + spriteBatch.DrawString(Bold, "Matrix Size: " + input.getSize().X.ToString() + " X " + input.getSize().Y.ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 242), Color.Teal); + spriteBatch.DrawString(Bold, "House Position: " + houseUnit.getVector() / input.getSpacingTile(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 262), Color.Teal); tractorUnit.getFarm().drawWeatherInformation(spriteBatch, Bold, input); spriteBatch.DrawString(Bold, "Total Weight: ", new Vector2(700, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 182), Color.DarkRed); - spriteBatch.DrawString(Bold, "(" + tractorUnit.getInventory().getWeight() + "/" + tractorUnit.getInventory().getMaxWeight() + ")", new Vector2(800, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 182), Color.DarkBlue); - - tractorUnit.drawInventory(input, spriteBatch, Bold, inventory.getPredefinedItems()); - - InspectTile(); - + spriteBatch.DrawString(Bold, "(" + tractorUnit.getInventory().getWeight() + "/" + tractorUnit.getInventory().getMaxWeight() + ")", new Vector2(800, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 182), Color.Teal); spriteBatch.Draw(mouseCursor, new Rectangle((int)mousePosition.X, (int)mousePosition.Y, 14, 21), Color.White); spriteBatch.End(); + spriteBatch.Begin(); + InspectTile(); + spriteBatch.End(); base.Draw(gameTime); } @@ -327,7 +338,7 @@ namespace Game1 public void InspectTile() { spriteBatch.DrawString(Bold, "Crop:", new Vector2(240, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed); - spriteBatch.DrawString(Bold, "Selected tile: (" + x.ToString() + ", " + y.ToString() + ")", new Vector2(240, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 22), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Selected tile: (" + x.ToString() + ", " + y.ToString() + ")", new Vector2(240, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 22), Color.Teal); tractorUnit.getFarm().getCrop(x, y).Inspect(input.getTileSize(), input.getSpacing(), Bold, new SpriteBatch(GraphicsDevice), cropTypesNames); } } diff --git a/Game1/Sources/Crops/CropType.cs b/Game1/Sources/Crops/CropType.cs index 1a42e12..0be77ec 100644 --- a/Game1/Sources/Crops/CropType.cs +++ b/Game1/Sources/Crops/CropType.cs @@ -12,12 +12,16 @@ class CropTypes public string[] soilType = new string[3]; public int[] Times = new int[3]; public string CropName; + public string[] Season = new string[5]; public float Temparature; public float Humidity; public float Moisture; public float Nitrogen; public float Potassium; public float Phosphorous; + public float Area; + public int AreaMin; + public int AreaMax; public CropTypes() diff --git a/Game1/Sources/Crops/CropTypesHolder.cs b/Game1/Sources/Crops/CropTypesHolder.cs index 4312ab6..ea2025d 100644 --- a/Game1/Sources/Crops/CropTypesHolder.cs +++ b/Game1/Sources/Crops/CropTypesHolder.cs @@ -36,6 +36,10 @@ class CropTypesHolder cropTypes[1].Nitrogen = 21 + 12.6f; cropTypes[1].Potassium = 10 + 5.3f; cropTypes[1].Phosphorous = 20 + 26.0f; + cropTypes[1].Season[0] = "Spring"; + cropTypes[1].Season[1] = "Autumn"; + cropTypes[1].AreaMin = 1; + cropTypes[1].AreaMax = 8000; // Cotton @@ -53,6 +57,11 @@ class CropTypesHolder cropTypes[2].Nitrogen = 21 + 16.4f; cropTypes[2].Potassium = 10 + 3.3f; cropTypes[2].Phosphorous = 20 + 23.8f; + cropTypes[2].Season[0] = "Spring"; + cropTypes[2].Season[1] = "Autumn"; + cropTypes[2].Season[2] = "Whole Year"; + cropTypes[2].AreaMin = 1; + cropTypes[2].AreaMax = 199000; // Ground Nuts cropTypes[3] = new CropTypes(); @@ -66,6 +75,13 @@ class CropTypesHolder cropTypes[3].Nitrogen = 21 + 23.3f; cropTypes[3].Potassium = 10 + 2.0f; cropTypes[3].Phosphorous = 20 + 21.6f; + cropTypes[3].Season[0] = "Spring"; + cropTypes[3].Season[1] = "Autumn"; + cropTypes[3].Season[2] = "Whole Year"; + cropTypes[3].Season[3] = "Winter"; + cropTypes[3].Season[4] = "Summer"; + cropTypes[3].AreaMin = 1; + cropTypes[3].AreaMax = 147000; // Maize @@ -80,6 +96,13 @@ class CropTypesHolder cropTypes[4].Nitrogen = 21 + 18.3f; cropTypes[4].Potassium = 10 + 5.7f; cropTypes[4].Phosphorous = 20 + 18.7f; + cropTypes[4].Season[0] = "Spring"; + cropTypes[4].Season[1] = "Autumn"; + cropTypes[4].Season[2] = "Whole Year"; + cropTypes[4].Season[3] = "Winter"; + cropTypes[4].Season[4] = "Summer"; + cropTypes[4].AreaMin = 1; + cropTypes[4].AreaMax = 73000; // Millets cropTypes[5] = new CropTypes(); @@ -95,6 +118,11 @@ class CropTypesHolder cropTypes[5].Nitrogen = 21 + 23.2f; cropTypes[5].Potassium = 10 + 0.1f; cropTypes[5].Phosphorous = 20 + 14.4f; + cropTypes[5].Season[0] = "Spring"; + cropTypes[5].Season[1] = "Autumn"; + cropTypes[5].Season[2] = "Whole Year"; + cropTypes[5].AreaMin = 1; + cropTypes[5].AreaMax = 59000; //Oil Seeds cropTypes[6] = new CropTypes(); @@ -108,6 +136,9 @@ class CropTypesHolder cropTypes[6].Nitrogen = 21 + 19.0f; cropTypes[6].Potassium = 10 + 2.3f; cropTypes[6].Phosphorous = 20 + 17.3f; + cropTypes[6].Season[0] = "Whole Year"; + cropTypes[6].AreaMin = 25; + cropTypes[6].AreaMax = 25000; //Paddys cropTypes[7] = new CropTypes(); @@ -121,6 +152,11 @@ class CropTypesHolder cropTypes[7].Nitrogen = 21 + 20.8f; cropTypes[7].Potassium = 10 + 3.7f; cropTypes[7].Phosphorous = 20 + 16.3f; + cropTypes[7].Season[0] = "Autumn"; + cropTypes[7].Season[1] = "Winter"; + cropTypes[7].Season[2] = "Summer"; + cropTypes[7].AreaMin = 200; + cropTypes[7].AreaMax = 270000; //Pulses cropTypes[8] = new CropTypes(); @@ -134,6 +170,12 @@ class CropTypesHolder cropTypes[8].Nitrogen = 21 + 18.4f; cropTypes[8].Potassium = 10 + 4.2f; cropTypes[8].Phosphorous = 20 + 17.5f; + cropTypes[8].Season[0] = "Spring"; + cropTypes[8].Season[1] = "Autumn"; + cropTypes[8].Season[2] = "Whole Year"; + cropTypes[8].Season[3] = "Summer"; + cropTypes[8].AreaMin = 40; + cropTypes[8].AreaMax = 140000; //Sugarcane cropTypes[9] = new CropTypes(); @@ -149,6 +191,12 @@ class CropTypesHolder cropTypes[9].Nitrogen = 21 + 14.6f; cropTypes[9].Potassium = 10 + 4.2f; cropTypes[9].Phosphorous = 20 + 17.6f; + cropTypes[9].Season[0] = "Spring"; + cropTypes[9].Season[1] = "Autumn"; + cropTypes[9].Season[2] = "Whole Year"; + cropTypes[9].Season[3] = "Winter"; + cropTypes[9].AreaMin = 1; + cropTypes[9].AreaMax = 23000; //Tobacco @@ -163,6 +211,11 @@ class CropTypesHolder cropTypes[10].Nitrogen = 21 + 19.1f; cropTypes[10].Potassium = 10 + 4.9f; cropTypes[10].Phosphorous = 20 + 19.3f; + cropTypes[10].Season[0] = "Spring"; + cropTypes[10].Season[1] = "Autumn"; + cropTypes[10].Season[2] = "Whole Year"; + cropTypes[10].AreaMin = 1; + cropTypes[10].AreaMax = 9500; //Wheat @@ -177,6 +230,12 @@ class CropTypesHolder cropTypes[11].Nitrogen = 21 + 23.3f; cropTypes[11].Potassium = 10 + 2.9f; cropTypes[11].Phosphorous = 20 + 14.4f; + cropTypes[11].Season[0] = "Spring"; + cropTypes[11].Season[1] = "Autumn"; + cropTypes[11].Season[2] = "Whole Year"; + cropTypes[11].Season[3] = "Summer"; + cropTypes[11].AreaMin = 1; + cropTypes[11].AreaMax = 266000; } diff --git a/Game1/Sources/Crops/Crops.cs b/Game1/Sources/Crops/Crops.cs index 497ca7a..012fc76 100644 --- a/Game1/Sources/Crops/Crops.cs +++ b/Game1/Sources/Crops/Crops.cs @@ -215,27 +215,30 @@ class Crops } - if (Rain >= 0.5f) + if (Rain >= 0.45f) { - soilProperties.Rainfall = soilProperties.Rainfall + (float)Math.Pow(Rain, 1.5f); - } - else - { - soilProperties.Rainfall = soilProperties.Rainfall - 0.1f; + soilProperties.Rainfall = soilProperties.Rainfall + Rain * 600; } } - public void setPrevRainfall(float nRainfall) + public void setPrevRainfall() { - soilProperties.prevRainfall = nRainfall; + + soilProperties.prevRainfall = soilProperties.Rainfall; + if (soilProperties.prevRainfall > 3616) + soilProperties.prevRainfall = 3616; + else if (soilProperties.prevRainfall < 236) + soilProperties.prevRainfall = 236; soilProperties.Rainfall = 0; + } public void setCropType(int Type, CropTypes nCropType) { DataSet = nCropType; + soilProperties.Area = r.Next(nCropType.AreaMin, nCropType.AreaMax); cropType = Type; } @@ -383,26 +386,26 @@ class Crops spriteBatch.Begin(); if (housePos) { - spriteBatch.DrawString(Bold, "Tiletype: House", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Tiletype: House", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.Teal); } else if (Status == 0) { - spriteBatch.DrawString(Bold, "Tiletype: Boulders", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Tiletype: Boulders", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.Teal); } else if (Status == 1) { - spriteBatch.DrawString(Bold, "Tiletype: Grassfield", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Tiletype: Grassfield", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.Teal); } else if (Status == 2) { - spriteBatch.DrawString(Bold, "Tiletype: Soil", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Tiletype: Soil", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.Teal); } else if (Status == 3) { int x = (int)(((float)Timer / fullTimer) * 100); x = 100 - x; - spriteBatch.DrawString(Bold, "Tiletype: Crop ", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.DarkBlue); - spriteBatch.DrawString(Bold, "Completion: " + x + "%", new Vector2(240, Size.Y * (tileSize + Spacing) + 82), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Tiletype: Crop ", new Vector2(240, Size.Y * (tileSize + Spacing) + 42), Color.Teal); + spriteBatch.DrawString(Bold, "Completion: " + x + "%", new Vector2(240, Size.Y * (tileSize + Spacing) + 82), Color.Teal); } if (Status != 3) { @@ -410,35 +413,37 @@ class Crops } if (Status > 1) { - spriteBatch.DrawString(Bold, "Prefered Crop: " + cropTypesNames[cropType], new Vector2(240, Size.Y * (tileSize + Spacing) + 62), Color.DarkBlue); + spriteBatch.DrawString(Bold, "Prefered Crop: " + cropTypesNames[cropType], new Vector2(240, Size.Y * (tileSize + Spacing) + 62), Color.Teal); } else { - spriteBatch.DrawString(Bold, "None", new Vector2(240, Size.Y * (tileSize + Spacing) + 62), Color.DarkBlue); + spriteBatch.DrawString(Bold, "None", new Vector2(240, Size.Y * (tileSize + Spacing) + 62), Color.Teal); } spriteBatch.DrawString(Bold, "Soil Properties:", new Vector2(240, Size.Y * (tileSize + Spacing) + 122), Color.DarkRed); spriteBatch.DrawString(Bold, "Soil Type: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 142), Color.DarkRed); - spriteBatch.DrawString(Bold, soilProperties.soilType, new Vector2(370, Size.Y * (tileSize + Spacing) + 142), Color.DarkBlue); + spriteBatch.DrawString(Bold, soilProperties.soilType, new Vector2(370, Size.Y * (tileSize + Spacing) + 142), Color.Teal); spriteBatch.DrawString(Bold, "Temparature: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 162), Color.DarkRed); - spriteBatch.DrawString(Bold, soilProperties.Temperature.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 162), Color.DarkBlue); + spriteBatch.DrawString(Bold, soilProperties.Temperature.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 162), Color.Teal); spriteBatch.DrawString(Bold, "Moisture: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 182), Color.DarkRed); - spriteBatch.DrawString(Bold, soilProperties.Moisture.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 182), Color.DarkBlue); + spriteBatch.DrawString(Bold, soilProperties.Moisture.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 182), Color.Teal); spriteBatch.DrawString(Bold, "Humidity: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 202), Color.DarkRed); - spriteBatch.DrawString(Bold, soilProperties.Humidity.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 202), Color.DarkBlue); + spriteBatch.DrawString(Bold, soilProperties.Humidity.ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 202), Color.Teal); spriteBatch.DrawString(Bold, "Phosphorous: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 222), Color.DarkRed); - spriteBatch.DrawString(Bold, Math.Round(soilProperties.Phosphorous,1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 222), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round(soilProperties.Phosphorous,1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 222), Color.Teal); spriteBatch.DrawString(Bold, "Potassium: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 242), Color.DarkRed); - spriteBatch.DrawString(Bold, Math.Round(soilProperties.Potassium, 1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 242), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round(soilProperties.Potassium, 1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 242), Color.Teal); spriteBatch.DrawString(Bold, "Nitrogen: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 262), Color.DarkRed); - spriteBatch.DrawString(Bold, Math.Round(soilProperties.Nitrogen, 1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 262), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round(soilProperties.Nitrogen, 1).ToString(), new Vector2(370, Size.Y * (tileSize + Spacing) + 262), Color.Teal); spriteBatch.DrawString(Bold, "Production Rate: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 282), Color.DarkRed); - spriteBatch.DrawString(Bold, Math.Round((ProductionRate * 100), 1).ToString() + "%", new Vector2(370, Size.Y * (tileSize + Spacing) + 282), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round((ProductionRate * 100), 1).ToString() + "%", new Vector2(370, Size.Y * (tileSize + Spacing) + 282), Color.Teal); spriteBatch.DrawString(Bold, "Last Years Rainfall: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 302), Color.DarkRed); - spriteBatch.DrawString(Bold, Math.Round((soilProperties.prevRainfall), 1).ToString() + "mm", new Vector2(370, Size.Y * (tileSize + Spacing) + 302), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round((soilProperties.prevRainfall), 1).ToString() + "mm", new Vector2(370, Size.Y * (tileSize + Spacing) + 302), Color.Teal); spriteBatch.DrawString(Bold, "Rainfall: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 322), Color.DarkRed); - spriteBatch.DrawString(Bold, Math.Round((soilProperties.Rainfall), 1).ToString() + "mm", new Vector2(370, Size.Y * (tileSize + Spacing) + 322), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round((soilProperties.Rainfall), 1).ToString() + "mm", new Vector2(370, Size.Y * (tileSize + Spacing) + 322), Color.Teal); spriteBatch.DrawString(Bold, "Rain mm/s: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 342), Color.DarkRed); - spriteBatch.DrawString(Bold, Math.Round((tempRain * 2), 2).ToString() + "mm", new Vector2(370, Size.Y * (tileSize + Spacing) + 342), Color.DarkBlue); + spriteBatch.DrawString(Bold, Math.Round((tempRain * 2), 2).ToString() + "mm", new Vector2(370, Size.Y * (tileSize + Spacing) + 342), Color.Teal); + spriteBatch.DrawString(Bold, "Area: ", new Vector2(240, Size.Y * (tileSize + Spacing) + 362), Color.DarkRed); + spriteBatch.DrawString(Bold, soilProperties.Area + "m^2", new Vector2(370, Size.Y * (tileSize + Spacing) + 362), Color.Teal); spriteBatch.End(); } } diff --git a/Game1/Sources/Crops/Farm.cs b/Game1/Sources/Crops/Farm.cs index b92376b..36cd5de 100644 --- a/Game1/Sources/Crops/Farm.cs +++ b/Game1/Sources/Crops/Farm.cs @@ -72,20 +72,12 @@ class Farm init(Size, housepos); RainPosition.X = r.Next(0, 1900); RainPosition.Y = r.Next(0, 1950); - RainPosition.X = 1970; - RainPosition.Y = 155; RainfallMap = PerlinNoise.LoadImage("C:\\Users\\Joel\\source\\repos\\Oskars Repo\\Game1\\Content\\Rainfall.png"); //RainfallMap = PerlinNoise.LoadImage("C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/Rainfall.png"); } public Rectangle getRainPosition(int TileSize, int x, int y, Vector2 Size) { - Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y)); - if (temp.X >= 1999 - Size.X - 1) - temp.X = x + (1999 - (int)Math.Round(RainPosition.X) - Size.X); - if (temp.Y >= 1999 - Size.Y - 1) - temp.Y = (1999 - (int)Math.Round(RainPosition.Y)); - float xtrunc = RainPosition.X - (float)Math.Truncate(RainPosition.X); float ytrunc = RainPosition.Y - (float)Math.Truncate(RainPosition.Y); @@ -107,20 +99,20 @@ class Farm { Vector2 temp = new Vector2((int)Math.Round(x + RainPosition.X), y + (int)Math.Round(RainPosition.Y)); if (temp.X >= 1999 - Size.X - 1) - temp.X = x + (1999 - (int)Math.Round(RainPosition.X)); + temp.X = -(1999 - (int)Math.Round(RainPosition.X)); if (temp.Y >= 1999 - Size.Y - 1) - temp.Y = (1999 - (int)Math.Round(RainPosition.Y)); + temp.Y = -(1999 - (int)Math.Round(RainPosition.Y)); return new Rectangle((int)temp.X, (int)temp.Y, 1, 1); } public void drawWeatherInformation(SpriteBatch spriteBatch, SpriteFont Bold, Input input) { - spriteBatch.DrawString(Bold, "WindSpeed: " + Math.Round(WindSpeed.X, 4), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 282), Color.DarkBlue); - spriteBatch.DrawString(Bold, " : ", new Vector2(153, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 282), Color.DarkBlue); - spriteBatch.DrawString(Bold, Math.Round(WindSpeed.Y, 4).ToString(), new Vector2(163, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 282), Color.DarkBlue); + spriteBatch.DrawString(Bold, "WindSpeed: " + Math.Round(WindSpeed.X, 4), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 282), Color.Teal); + spriteBatch.DrawString(Bold, " : ", new Vector2(153, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 282), Color.Teal); + spriteBatch.DrawString(Bold, Math.Round(WindSpeed.Y, 4).ToString(), new Vector2(163, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 282), Color.Teal); } - public void updateFarm(Vector2 Size, int nDay) + public void updateFarm(Vector2 Size) { Update++; if (Update == 30) @@ -133,9 +125,7 @@ class Farm if (temp.X >= 1999 - Size.X - 1) temp.X = i + ((1999 - (int)Math.Round(RainPosition.X))); if (temp.Y >= 1999 - Size.Y - 1) - temp.Y = (1999 - (int)Math.Round(RainPosition.Y)); - if (temp.X == -1) - temp.X = 1999; + temp.Y = i + ((1999 - (int)Math.Round(RainPosition.Y))); crops[i, j].updateCrop(Size, RainfallMap[(int)Math.Round(temp.X)][(int)Math.Round(temp.Y)].GetBrightness()); } } @@ -145,6 +135,19 @@ class Farm updateRainMapPosition(Size); } + public void updateRainFall(Vector2 Size, bool nDay) + { + if (nDay) + { + for (int i = 0; i < Size.X; i++) + { + for (int j = 0; j < Size.Y; j++) + { + crops[i, j].setPrevRainfall(); + } + } + } + } //Changes the properties of the tile when the tractor reaches this tile. public void setCropStatus(float xfloat, float yfloat) @@ -182,8 +185,7 @@ class Farm float x, y; x = WindSpeed.X + GetRandomNumber(-1f, 1f) / 2000; y = WindSpeed.Y + GetRandomNumber(-1f, 1f) / 2000; - x = 0.02f; - if (x <= 1f && x >= -1f) + if (x <= 0.02f && x >= -0.02f) { WindSpeed.X = x; } @@ -208,10 +210,10 @@ class Farm else if (Math.Round(RainPosition.X) == 1 && WindSpeed.X < 0) RainPosition.X = 1999; - if (Math.Round(RainPosition.Y) == 1999 - Size.Y - 1 && WindSpeed.Y > 0) + if (Math.Round(RainPosition.Y) == 1999 && WindSpeed.Y > 0) RainPosition.Y = 0; - if (Math.Round(RainPosition.Y) == 1 && WindSpeed.Y < 0) - RainPosition.Y = 1999 - Size.Y - 1; + else if (Math.Round(RainPosition.Y) == 1 && WindSpeed.Y < 0) + RainPosition.Y = 1999; } public void setNewHousePos(Vector2 pos, bool newState) @@ -266,11 +268,13 @@ class Farm Vector2 temp = new Vector2(x + (int)Math.Round(RainPosition.X), y + (int)Math.Round(RainPosition.Y)); if (temp.X >= 1999) temp.X = -(1999 - (int)Math.Round(temp.X)); - if (temp.Y >= 1999 - Size.Y - 1) - temp.Y = (1999 - (int)Math.Round(RainPosition.Y)); + if (temp.Y >= 1999) + temp.Y = -(1999 - (int)Math.Round(temp.Y)); if (temp.X == -1) temp.X = 1999; - if (RainfallMap[(int)temp.X][(int)temp.Y].GetBrightness() < 0.4f) + if (temp.Y == -1) + temp.Y = 1999; + if (RainfallMap[(int)temp.X][(int)temp.Y].GetBrightness() < 0.45f) { return Color.FromNonPremultiplied(color.R, color.G, color.B, (int)(0)); } diff --git a/Game1/Sources/Crops/SoilProperties.cs b/Game1/Sources/Crops/SoilProperties.cs index 01c172f..ea7342c 100644 --- a/Game1/Sources/Crops/SoilProperties.cs +++ b/Game1/Sources/Crops/SoilProperties.cs @@ -23,6 +23,7 @@ class SoilProperties public float PotassiumDegradeRate = 1.0f - (1.0f/28 * 23); public float PhosphorousDegradeRate = 1.0f - (1.0f/60 * 37); public int Capacity = 80; + public int Area; public void setSoilProperties() { @@ -54,6 +55,7 @@ class SoilProperties Potassium = GetRandomNumber(0.01f, 19); // was 0, 28 Phosphorous = GetRandomNumber(0.01f, 42); // was 0, 60 prevRainfall = r.Next(247, 3617); + Area = r.Next(1, 270000); } public float GetRandomNumber(double minimum, double maximum) diff --git a/Game1/Sources/Objects/DayNightCycle.cs b/Game1/Sources/Objects/DayNightCycle.cs index f9c62bf..1ffb44c 100644 --- a/Game1/Sources/Objects/DayNightCycle.cs +++ b/Game1/Sources/Objects/DayNightCycle.cs @@ -7,15 +7,17 @@ using Microsoft.Xna.Framework; class DayNightCycle { - private bool Time = true; + private bool Time = false; private int nightTime = 0; private int dayTime = 0; private int lengthOfDay = 20000; private int lengthOfNight = 20000; - private int Days = 1; + private int Days = 1; + private int DaysOfYear = 0; public void updateTime(int Speed) { + Time = false; for (int i = 0; i < Speed; i++) { if (Time) @@ -35,21 +37,34 @@ class DayNightCycle Time = true; nightTime = 0; Days++; + DaysOfYear++; } } + if (DaysOfYear == 365) + { + DaysOfYear = 0; + } } + } - public string getDayNight() + //Season: + //0 - Whole Year + //1 - Spring + //2 - Summer + //3 - Autumn + //4 - Winter + + public int getTimeOfYear() { - if (Time) - { - return "Day"; - } + if (DaysOfYear < 93) + return 1; + else if (DaysOfYear < 187) + return 2; + else if (DaysOfYear < 276) + return 3; else - { - return "Night"; - } + return 4; } public Color GetTimeOfDay() @@ -108,14 +123,17 @@ class DayNightCycle } } } - /* - red = (int)(red / 1.2f); - blue = (int)(blue / 1.2f); - green = (int)(green / 1.2f); - */ return Color.FromNonPremultiplied(red, green, blue, 255); } + public bool nDay() + { + if (Time) + return true; + else + return false; + } + public int GetTimeOfDayInt() { if (Time) diff --git a/Game1/Sources/Objects/InventorySystem/Inventory.cs b/Game1/Sources/Objects/InventorySystem/Inventory.cs index aa82a68..2ca7d48 100644 --- a/Game1/Sources/Objects/InventorySystem/Inventory.cs +++ b/Game1/Sources/Objects/InventorySystem/Inventory.cs @@ -159,16 +159,16 @@ class Inventory spriteBatch.DrawString(Bold, "Harvested:", new Vector2(600, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed); for (int i = 0; i < 11; i++) //Print Crops { - spriteBatch.DrawString(Bold, cargo.getCount(i, 1) + " " + itemStorage.getItemByIndex(i, 1).getItemType(), new Vector2(470, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.DarkBlue); - spriteBatch.DrawString(Bold, totalHarvested[i].ToString(), new Vector2(620, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.DarkBlue); + spriteBatch.DrawString(Bold, cargo.getCount(i, 1) + " " + itemStorage.getItemByIndex(i, 1).getItemType(), new Vector2(470, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.Teal); + spriteBatch.DrawString(Bold, totalHarvested[i].ToString(), new Vector2(620, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.Teal); } spriteBatch.DrawString(Bold, "Fertilizers: ", new Vector2(700, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed); spriteBatch.DrawString(Bold, "Used ", new Vector2(830, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed); for (int i = 0; i < 7; i++) //Print Fertilizers { - spriteBatch.DrawString(Bold, cargo.getCount(i, 0) + " " + itemStorage.getItemByIndex(i, 0).getItemType(), new Vector2(700, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.DarkBlue); - spriteBatch.DrawString(Bold, totalFertilizerUsed[i].ToString(), new Vector2(835, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.DarkBlue); + spriteBatch.DrawString(Bold, cargo.getCount(i, 0) + " " + itemStorage.getItemByIndex(i, 0).getItemType(), new Vector2(700, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.Teal); + spriteBatch.DrawString(Bold, totalFertilizerUsed[i].ToString(), new Vector2(835, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 20 * i + 22), Color.Teal); } diff --git a/Game1/Sources/Objects/Tractor.cs b/Game1/Sources/Objects/Tractor.cs index 8266d46..db4745b 100644 --- a/Game1/Sources/Objects/Tractor.cs +++ b/Game1/Sources/Objects/Tractor.cs @@ -22,7 +22,7 @@ class Tractor Size = input.getSize(); updatePosition(input.getSize(), Status); housePos = newHousePos; - smartTractor.UpdateCrops(Speed, Time.getDays()); + smartTractor.UpdateCrops(Speed, Time.nDay()); } diff --git a/Game1/Sources/Smart/SmartTractor.cs b/Game1/Sources/Smart/SmartTractor.cs index 80ff965..e0bc9b5 100644 --- a/Game1/Sources/Smart/SmartTractor.cs +++ b/Game1/Sources/Smart/SmartTractor.cs @@ -74,12 +74,13 @@ class SmartTractor farm.setNewHousePos(pos, newState); } - public void UpdateCrops(int Speed, int nDay) + public void UpdateCrops(int Speed, bool nDay) { for (int i = 0; i < Speed; i++) { - farm.updateFarm(Size, nDay); + farm.updateFarm(Size); } + farm.updateRainFall(Size, nDay); } public Inventory getInventory()