using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; class SmartTractor { private AI ai = new AI(); private Farm farm = new Farm(); private Astar astar = new Astar(); private Vector2 housePos, tractorPos, Size, Target; private int Score, Rotation, tileSize = 56, Spacing = 1; //What to do next public Path returnChoice() { ai.update(farm, Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target / (tileSize + Spacing), Rotation); farm.UpdatePreferedCrops(Size); farm = ai.changeCropStatus(); getTargetPosition(ai.newTarget()); astar.update(farm.getCrops(), Size, tractorPos / (tileSize + Spacing), housePos / (tileSize + Spacing), Target/(tileSize+Spacing), Rotation); return astar.FindPath(); } //Updates the variables every frame public void updateMap(Vector2 newTractorPos, Vector2 newHousePos, Vector2 newSize, int newTileSize, int newSpacing, int rotation) { housePos = newHousePos; tractorPos = newTractorPos; Size = newSize; tileSize = newTileSize; Spacing = newSpacing; Rotation = rotation; } public void init() { ai.init(); farm.init(new Vector2(100, (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height / tileSize) - 125 / tileSize), housePos / (tileSize + Spacing)); } public void drawInventory(Input input, SpriteBatch spriteBatch, SpriteFont Bold, Cargo itemStorageDefined) { ai.drawInventory(input, spriteBatch, Bold, itemStorageDefined); } private void getTargetPosition(Vector2 newTarget) { Target = newTarget * (tileSize + Spacing); } public Farm getFarm() { return farm; } public void setNewHousePos(Vector2 pos, bool newState) { farm.setNewHousePos(pos, newState); } public void UpdateCrops(int Speed) { for (int i = 0; i < Speed; i++) { farm.updateFarm(Size); } } public Inventory getInventory() { return ai.getInventory(); } }