This commit is contained in:
Joel 2020-05-24 16:51:29 +02:00
parent 64aaef69dd
commit eb99fd3f02

View File

@ -72,8 +72,8 @@ class Farm
init(Size, housepos);
RainPosition.X = r.Next(0, 1900);
RainPosition.Y = r.Next(0, 1950);
RainPosition.X = 5;
RainPosition.Y = 5;
RainPosition.X = 1980;
RainPosition.Y = 800;
RainfallMap = PerlinNoise.LoadImage("C:\\Users\\Joel\\source\\repos\\Oskars Repo\\Game1\\Content\\Rainfall.png");
}
@ -99,10 +99,10 @@ class Farm
public Rectangle getDestinationRectangle(int x, int y, Vector2 Size)
{
Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y));
if (RainPosition.X >= 1999 - Size.X)
temp.X = (Size.X) - (1999 - (int)Math.Round(RainPosition.X));
if (RainPosition.Y >= 1999 - Size.Y)
temp.Y = (Size.Y) - (1999 - (int)Math.Round(RainPosition.Y));
if (RainPosition.X >= 1999 - Size.X - 1)
temp.X = (1999 - (int)Math.Round(RainPosition.X));
if (RainPosition.Y >= 1999 - Size.Y - 1)
temp.Y = (1999 - (int)Math.Round(RainPosition.Y));
return new Rectangle(x + (int)temp.X, y + (int)temp.Y, 1, 1);
}
@ -123,10 +123,10 @@ class Farm
for (int j = 0; j < Size.Y; j++)
{
Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y));
if (RainPosition.X >= 1999 - Size.X)
temp.X = (Size.X) - (1999 - (int)Math.Round(RainPosition.X));
if (RainPosition.Y >= 1999 - Size.Y)
temp.Y = (Size.Y) - (1999 - (int)Math.Round(RainPosition.Y));
if (RainPosition.X >= 1999 - Size.X - 1)
temp.X = (1999 - (int)Math.Round(RainPosition.X));
if (RainPosition.Y >= 1999 - Size.Y - 1)
temp.Y = (1999 - (int)Math.Round(RainPosition.Y));
crops[i, j].updateCrop(Size, RainfallMap[(int)Math.Round(temp.X) + i][(int)Math.Round(temp.Y) + j].GetBrightness());
}
}
@ -173,7 +173,7 @@ class Farm
float x, y;
x = WindSpeed.X + GetRandomNumber(-1f, 1f) / 2000;
y = WindSpeed.Y + GetRandomNumber(-1f, 1f) / 2000;
x = -0.02f;
x = 0.02f;
if (x <= 1f && x >= -1f)
{
WindSpeed.X = x;
@ -255,10 +255,12 @@ class Farm
public Color getRainAmount(int x, int y, Color color, Vector2 Size)
{
Vector2 temp = new Vector2(x + (int)Math.Round(RainPosition.X), y + (int)Math.Round(RainPosition.Y));
if (RainPosition.X >= 1999 - Size.X)
temp.X = (Size.X) - (1999 - (int)Math.Round(RainPosition.X));
if (RainPosition.Y >= 1999 - Size.Y)
temp.Y = (Size.Y) - (1999 - (int)Math.Round(RainPosition.Y));
if (RainPosition.X >= 1999 - Size.X - 1)
temp.X = (1999 - (int)Math.Round(RainPosition.X) + x);
if (RainPosition.Y >= 1999 - Size.Y - 1)
temp.Y = (1999 - (int)Math.Round(RainPosition.Y) + y);
if (temp.X == -1)
temp.X = 1999;
if (RainfallMap[(int)temp.X][(int)temp.Y].GetBrightness() < 0.4f)
{
return Color.FromNonPremultiplied(color.R, color.G, color.B, (int)(0));