diff --git a/Game1/Sources/Objects/Tractor.cs b/Game1/Sources/Objects/Tractor.cs index ba899ed..f56278d 100644 --- a/Game1/Sources/Objects/Tractor.cs +++ b/Game1/Sources/Objects/Tractor.cs @@ -9,6 +9,8 @@ class Tractor private Path path = new Path(); private SmartTractor smartTractor = new SmartTractor(); private HandleRotation handleRotation = new HandleRotation(); + private int j = 60; + public void updateSizing(Input input, int Status, Vector2 newHousePos, DayNightCycle Time) { @@ -61,7 +63,6 @@ class Tractor public void updatePosition(Vector2 Size, int Status) // updates the position { - //farm.updateSize(Size, sizeTile, Spacing); for (int i = 0; i < Speed; i++) { diff --git a/Game1/Sources/Smart/AI.cs b/Game1/Sources/Smart/AI.cs index 06327d5..44f007e 100644 --- a/Game1/Sources/Smart/AI.cs +++ b/Game1/Sources/Smart/AI.cs @@ -18,6 +18,7 @@ class AI private FertilizerHolder fertilizerHolder = new FertilizerHolder(); private int Rotation; private Astar astar = new Astar(); + public bool WaitTwoFrames { get; set; } private Random r = new Random(); @@ -95,6 +96,7 @@ class AI int y = (int)tractorPos.Y; Fertilizer fertilizer = new Fertilizer(); fertilizerHolder.init(); + WaitTwoFrames = false; if (farm.getCrop(x, y).getStatus() >= 2) { fertilizer = fertilizerHolder.GetFertilizer(Engine.PredictFertilizer(farm.getCrop(x, y), farm.getPresetCropTypes(farm.getCrop(x, y).getCropType()))); @@ -102,6 +104,7 @@ class AI { farm.getCrop(x, y).Fertilize(fertilizer); fertilizer = fertilizerHolder.GetFertilizer(Engine.PredictFertilizer(farm.getCrop(x, y), farm.getPresetCropTypes(farm.getCrop(x, y).getCropType()))); + WaitTwoFrames = true; //System.Threading.Thread.Sleep(5); } } diff --git a/Game1/Sources/Smart/SmartTractor.cs b/Game1/Sources/Smart/SmartTractor.cs index a80f27e..4524778 100644 --- a/Game1/Sources/Smart/SmartTractor.cs +++ b/Game1/Sources/Smart/SmartTractor.cs @@ -24,9 +24,8 @@ class SmartTractor //astar.update(farm.getCrops(), Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target / (tileSize + Spacing), Rotation); if (tractorPos == housePos) ai.reloadCargo(); + return ai.newTarget(); - - //return astar.FindPath(true); } @@ -85,4 +84,14 @@ class SmartTractor { return ai.getInventory(); } + + public bool getWaitTwoFrames() + { + return ai.WaitTwoFrames; + } + + public void setWaitTwoFrames(bool input) + { + ai.WaitTwoFrames = input; + } }