forked from s425077/PotatoPlan
gtyhsy
This commit is contained in:
parent
64aaef69dd
commit
eb99fd3f02
@ -72,8 +72,8 @@ class Farm
|
|||||||
init(Size, housepos);
|
init(Size, housepos);
|
||||||
RainPosition.X = r.Next(0, 1900);
|
RainPosition.X = r.Next(0, 1900);
|
||||||
RainPosition.Y = r.Next(0, 1950);
|
RainPosition.Y = r.Next(0, 1950);
|
||||||
RainPosition.X = 5;
|
RainPosition.X = 1980;
|
||||||
RainPosition.Y = 5;
|
RainPosition.Y = 800;
|
||||||
RainfallMap = PerlinNoise.LoadImage("C:\\Users\\Joel\\source\\repos\\Oskars Repo\\Game1\\Content\\Rainfall.png");
|
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)
|
public Rectangle getDestinationRectangle(int x, int y, Vector2 Size)
|
||||||
{
|
{
|
||||||
Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y));
|
Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y));
|
||||||
if (RainPosition.X >= 1999 - Size.X)
|
if (RainPosition.X >= 1999 - Size.X - 1)
|
||||||
temp.X = (Size.X) - (1999 - (int)Math.Round(RainPosition.X));
|
temp.X = (1999 - (int)Math.Round(RainPosition.X));
|
||||||
if (RainPosition.Y >= 1999 - Size.Y)
|
if (RainPosition.Y >= 1999 - Size.Y - 1)
|
||||||
temp.Y = (Size.Y) - (1999 - (int)Math.Round(RainPosition.Y));
|
temp.Y = (1999 - (int)Math.Round(RainPosition.Y));
|
||||||
return new Rectangle(x + (int)temp.X, y + (int)temp.Y, 1, 1);
|
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++)
|
for (int j = 0; j < Size.Y; j++)
|
||||||
{
|
{
|
||||||
Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y));
|
Vector2 temp = new Vector2((int)Math.Round(RainPosition.X), (int)Math.Round(RainPosition.Y));
|
||||||
if (RainPosition.X >= 1999 - Size.X)
|
if (RainPosition.X >= 1999 - Size.X - 1)
|
||||||
temp.X = (Size.X) - (1999 - (int)Math.Round(RainPosition.X));
|
temp.X = (1999 - (int)Math.Round(RainPosition.X));
|
||||||
if (RainPosition.Y >= 1999 - Size.Y)
|
if (RainPosition.Y >= 1999 - Size.Y - 1)
|
||||||
temp.Y = (Size.Y) - (1999 - (int)Math.Round(RainPosition.Y));
|
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());
|
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;
|
float x, y;
|
||||||
x = WindSpeed.X + GetRandomNumber(-1f, 1f) / 2000;
|
x = WindSpeed.X + GetRandomNumber(-1f, 1f) / 2000;
|
||||||
y = WindSpeed.Y + GetRandomNumber(-1f, 1f) / 2000;
|
y = WindSpeed.Y + GetRandomNumber(-1f, 1f) / 2000;
|
||||||
x = -0.02f;
|
x = 0.02f;
|
||||||
if (x <= 1f && x >= -1f)
|
if (x <= 1f && x >= -1f)
|
||||||
{
|
{
|
||||||
WindSpeed.X = x;
|
WindSpeed.X = x;
|
||||||
@ -255,10 +255,12 @@ class Farm
|
|||||||
public Color getRainAmount(int x, int y, Color color, Vector2 Size)
|
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));
|
Vector2 temp = new Vector2(x + (int)Math.Round(RainPosition.X), y + (int)Math.Round(RainPosition.Y));
|
||||||
if (RainPosition.X >= 1999 - Size.X)
|
if (RainPosition.X >= 1999 - Size.X - 1)
|
||||||
temp.X = (Size.X) - (1999 - (int)Math.Round(RainPosition.X));
|
temp.X = (1999 - (int)Math.Round(RainPosition.X) + x);
|
||||||
if (RainPosition.Y >= 1999 - Size.Y)
|
if (RainPosition.Y >= 1999 - Size.Y - 1)
|
||||||
temp.Y = (Size.Y) - (1999 - (int)Math.Round(RainPosition.Y));
|
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)
|
if (RainfallMap[(int)temp.X][(int)temp.Y].GetBrightness() < 0.4f)
|
||||||
{
|
{
|
||||||
return Color.FromNonPremultiplied(color.R, color.G, color.B, (int)(0));
|
return Color.FromNonPremultiplied(color.R, color.G, color.B, (int)(0));
|
||||||
|
Loading…
Reference in New Issue
Block a user