Updated the day night cycle

This commit is contained in:
Joel 2020-05-06 20:26:33 +02:00
parent 0063eb17f8
commit 75f9eb23ca
5 changed files with 34 additions and 6 deletions

View File

@ -176,8 +176,9 @@ namespace Game1
} }
spriteBatch.DrawString(Bold, "Time: ", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed); spriteBatch.DrawString(Bold, "Time: ", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 2), Color.DarkRed);
spriteBatch.DrawString(Bold, Time.getDayNight(), 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.DarkBlue);
spriteBatch.DrawString(Bold, Time.GetTimeOfDayInt().ToString(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 22), Color.DarkBlue); 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, "Tractor Properties:", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 62), Color.DarkRed); spriteBatch.DrawString(Bold, "Tractor Properties:", new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 62), Color.DarkRed);
@ -194,6 +195,9 @@ namespace Game1
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, "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, "House Position: " + houseUnit.getVector() / input.getSpacingTile(), new Vector2(10, input.getSize().Y * (input.getTileSize() + input.getSpacing()) + 262), Color.DarkBlue);
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()); tractorUnit.drawInventory(input, spriteBatch, Bold, inventory.getPredefinedItems());
InspectTile(); InspectTile();

View File

@ -10,8 +10,9 @@ class DayNightCycle
private bool Time = true; private bool Time = true;
private int nightTime = 0; private int nightTime = 0;
private int dayTime = 0; private int dayTime = 0;
private int lengthOfDay = 6000; private int lengthOfDay = 20000;
private int lengthOfNight = 6000; private int lengthOfNight = 20000;
private int Days;
public void updateTime(int Speed) public void updateTime(int Speed)
{ {
@ -33,6 +34,7 @@ class DayNightCycle
{ {
Time = true; Time = true;
nightTime = 0; nightTime = 0;
Days++;
} }
} }
} }
@ -104,11 +106,18 @@ class DayNightCycle
{ {
if (Time) if (Time)
{ {
return dayTime / 60; return (int)(100 * ((float)(dayTime + nightTime) / (lengthOfDay + lengthOfNight))) + 1;
} }
else else
{ {
return nightTime / 60; return (int)(100 * ((float)(lengthOfDay + nightTime) / (lengthOfDay + lengthOfNight))) + 1;
} }
}
public int getDays()
{
return Days;
} }
} }

View File

@ -154,4 +154,9 @@ class Tractor
{ {
smartTractor.drawInventory(input, spriteBatch, Bold, itemStorageDefined); smartTractor.drawInventory(input, spriteBatch, Bold, itemStorageDefined);
} }
public Inventory getInventory()
{
return smartTractor.getInventory();
}
} }

View File

@ -72,4 +72,9 @@ class AI
} }
return farm; return farm;
} }
public Inventory getInventory()
{
return inventory;
}
} }

View File

@ -74,4 +74,9 @@ class SmartTractor
farm.updateFarm(Size); farm.updateFarm(Size);
} }
} }
public Inventory getInventory()
{
return ai.getInventory();
}
} }