1
0
forked from s425077/PotatoPlan

Merge branch 'Joel-ML' of https://git.wmi.amu.edu.pl/s425077/PotatoPlan into Joel-ML

This commit is contained in:
BOTLester 2020-05-24 21:22:50 +02:00
commit 6bb5073048
6 changed files with 28 additions and 18 deletions

View File

@ -221,6 +221,7 @@ namespace Game1
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.Teal);
spriteBatch.DrawString(Bold, Time.getTimeOfYear(), new Vector2(120, 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.Teal);

View File

@ -22,11 +22,13 @@ class Crops
SoilProperties soilProperties = new SoilProperties();
private float ProductionRate;
private float tempRain;
public DayNightCycle Time { get; set; }
public void updateCrop(Vector2 newSize, float Rain)
public void updateCrop(Vector2 newSize, float Rain, DayNightCycle nTime)
{
Time = nTime;
tempRain = Rain;
getProductionRate(DataSet);
if (UpdateCrop == 60)
@ -237,9 +239,15 @@ class Crops
public void setCropType(int Type, CropTypes nCropType)
{
DataSet = nCropType;
soilProperties.Area = r.Next(nCropType.AreaMin, nCropType.AreaMax);
cropType = Type;
if (Status == 3)
{
soilProperties.Area = r.Next(nCropType.AreaMin, nCropType.AreaMax);
}
}
public int getStatus()

View File

@ -19,6 +19,7 @@ class Farm
private System.Drawing.Color[][] RainfallMap;
private float[][] whiteNoise;
private float[][] perlinNoise;
private DayNightCycle Time;
//initializes the crops
@ -126,7 +127,7 @@ class Farm
temp.X = i + ((1999 - (int)Math.Round(RainPosition.X)));
if (temp.Y >= 1999 - Size.Y - 1)
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());
crops[i, j].updateCrop(Size, RainfallMap[(int)Math.Round(temp.X)][(int)Math.Round(temp.Y)].GetBrightness(), Time);
}
}
@ -135,9 +136,10 @@ class Farm
updateRainMapPosition(Size);
}
public void updateRainFall(Vector2 Size, bool nDay)
public void updateRainFall(Vector2 Size, DayNightCycle nTime)
{
if (nDay)
Time = nTime;
if (nTime.nDay())
{
for (int i = 0; i < Size.X; i++)
{

View File

@ -40,7 +40,7 @@ class DayNightCycle
DaysOfYear++;
}
}
if (DaysOfYear == 365)
if (DaysOfYear == 48)
{
DaysOfYear = 0;
}
@ -55,16 +55,16 @@ class DayNightCycle
//3 - Autumn
//4 - Winter
public int getTimeOfYear()
public string getTimeOfYear()
{
if (DaysOfYear < 93)
return 1;
else if (DaysOfYear < 187)
return 2;
else if (DaysOfYear < 276)
return 3;
if (DaysOfYear < 12)
return "Spring";
else if (DaysOfYear < 24)
return "Summer";
else if (DaysOfYear < 36)
return "Autumn";
else
return 4;
return "Winter";
}
public Color GetTimeOfDay()

View File

@ -22,8 +22,7 @@ class Tractor
Size = input.getSize();
updatePosition(input.getSize(), Status);
housePos = newHousePos;
smartTractor.UpdateCrops(Speed, Time.nDay());
smartTractor.UpdateCrops(Speed, Time);
}
public void init(Rectangle house, Input input)

View File

@ -74,13 +74,13 @@ class SmartTractor
farm.setNewHousePos(pos, newState);
}
public void UpdateCrops(int Speed, bool nDay)
public void UpdateCrops(int Speed, DayNightCycle Time)
{
for (int i = 0; i < Speed; i++)
{
farm.updateFarm(Size);
}
farm.updateRainFall(Size, nDay);
farm.updateRainFall(Size, Time);
}
public Inventory getInventory()