forked from s425077/PotatoPlan
merge
This commit is contained in:
commit
c858261c89
@ -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
|
||||
|
||||
|
BIN
Game1/Content/WoodBackground.png
Normal file
BIN
Game1/Content/WoodBackground.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
@ -18,6 +18,7 @@ namespace Game1
|
||||
private Texture2D[] tileConnected = new Texture2D[5];
|
||||
private Texture2D[] Crops = new Texture2D[12];
|
||||
private Texture2D tractor;
|
||||
private Texture2D Background;
|
||||
private Texture2D house;
|
||||
private Texture2D markers;
|
||||
private Texture2D mouseCursor;
|
||||
@ -119,7 +120,7 @@ namespace Game1
|
||||
Rain = Content.Load<Texture2D>("Clouds");
|
||||
|
||||
|
||||
|
||||
Background = Content.Load<Texture2D>("WoodBackground");
|
||||
|
||||
|
||||
Crops[0] = Content.Load<Texture2D>("Markers");
|
||||
@ -197,46 +198,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);
|
||||
}
|
||||
|
||||
@ -329,7 +340,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);
|
||||
}
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
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);
|
||||
|
||||
@ -109,18 +101,18 @@ class Farm
|
||||
if (temp.X >= 1999 - Size.X - 1)
|
||||
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));
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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());
|
||||
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user