joined textures

This commit is contained in:
Joel 2020-05-23 13:54:47 +02:00
parent 122f957673
commit 037f15f2e4
3 changed files with 88 additions and 6 deletions

View File

@ -37,6 +37,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:BerriesIcon.png /build:BerriesIcon.png
#begin Bottom.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:Bottom.png
#begin CarronIcon.png #begin CarronIcon.png
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor
@ -104,6 +116,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:house.png /build:house.png
#begin Left.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:Left.png
#begin MaizeIcon.png #begin MaizeIcon.png
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor
@ -224,6 +248,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:PulsesIcon.png /build:PulsesIcon.png
#begin Right.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:Right.png
#begin SeedOilIcon.png #begin SeedOilIcon.png
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor
@ -284,6 +320,18 @@
/processorParam:TextureFormat=Color /processorParam:TextureFormat=Color
/build:TobaccoIcon.png /build:TobaccoIcon.png
#begin Top.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:Top.png
#begin Tractor.png #begin Tractor.png
/importer:TextureImporter /importer:TextureImporter
/processor:TextureProcessor /processor:TextureProcessor

View File

@ -15,6 +15,7 @@ namespace Game1
SpriteBatch spriteBatch; SpriteBatch spriteBatch;
SpriteFont Bold; SpriteFont Bold;
private Texture2D[] tile = new Texture2D[5]; private Texture2D[] tile = new Texture2D[5];
private Texture2D[] tileConnected = new Texture2D[5];
private Texture2D[] Crops = new Texture2D[12]; private Texture2D[] Crops = new Texture2D[12];
private Texture2D tractor; private Texture2D tractor;
private Texture2D house; private Texture2D house;
@ -102,6 +103,11 @@ namespace Game1
tile[2] = Content.Load<Texture2D>("Plantable"); tile[2] = Content.Load<Texture2D>("Plantable");
tile[3] = Content.Load<Texture2D>("Crop"); tile[3] = Content.Load<Texture2D>("Crop");
tileConnected[0] = Content.Load<Texture2D>("Left");
tileConnected[1] = Content.Load<Texture2D>("Top");
tileConnected[2] = Content.Load<Texture2D>("Right");
tileConnected[3] = Content.Load<Texture2D>("Bottom");
@ -238,6 +244,34 @@ namespace Game1
spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).getStatus()], tilePos, Time.GetTimeOfDay()); spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).getStatus()], tilePos, Time.GetTimeOfDay());
if (i > 0)
{
if (tractorUnit.getFarm().getCrop(i - 1, j).getStatus() == 2 || tractorUnit.getFarm().getCrop(i - 1, j).getStatus() == 3)
{
spriteBatch.Draw(tileConnected[0], tilePos, Time.GetTimeOfDay());
}
}
if (j > 0)
{
if (tractorUnit.getFarm().getCrop(i, j - 1).getStatus() == 2 || tractorUnit.getFarm().getCrop(i, j - 1).getStatus() == 3)
{
spriteBatch.Draw(tileConnected[1], tilePos, Time.GetTimeOfDay());
}
}
if (i < input.getSize().X)
{
if (tractorUnit.getFarm().getCrop(i + 1, j).getStatus() == 2 || tractorUnit.getFarm().getCrop(i + 1, j).getStatus() == 3)
{
spriteBatch.Draw(tileConnected[2], tilePos, Time.GetTimeOfDay());
}
}
if (j < input.getSize().Y)
{
if (tractorUnit.getFarm().getCrop(i, j + 1).getStatus() == 2 || tractorUnit.getFarm().getCrop(i, j + 1).getStatus() == 3)
{
spriteBatch.Draw(tileConnected[3], tilePos, Time.GetTimeOfDay());
}
}
if (tilePos.Intersects(mousePosition)) if (tilePos.Intersects(mousePosition))
{ {
spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).getStatus()], tilePos, Color.FromNonPremultiplied(0, 0, 20, 40)); spriteBatch.Draw(tile[tractorUnit.getFarm().getCrop(i, j).getStatus()], tilePos, Color.FromNonPremultiplied(0, 0, 20, 40));

View File

@ -11,12 +11,12 @@ using Microsoft.ML.Trainers.LightGbm;
class MLModel class MLModel
{ {
private static MLContext mlContext = new MLContext(seed: 1); private static MLContext mlContext = new MLContext(seed: 1);
private static string path = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/Fertilizer_Prediction.csv"; private static string path = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/Fertilizer_Prediction.csv";
private static string modelpath = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/MLmodel"; private static string modelpath = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodel";
private static string report = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/report"; private static string report = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report";
private static string pathBig = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/BigFertPredict.csv"; private static string pathBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/BigFertPredict.csv";
private static string modelpathBig = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/MLmodelBig"; private static string modelpathBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/MLmodelBig";
private static string reportBig = "C:/Users/Oskar/source/repos/PotatoPlanFinal/Game1/Content/ML/report_BigModel"; private static string reportBig = "C:/Users/Joel/source/repos/Oskars Repo/Game1/Content/ML/report_BigModel";
// Loading data, creatin and saving ML model for smaller dataset (100) // Loading data, creatin and saving ML model for smaller dataset (100)
public static void CreateModel() public static void CreateModel()