// Attempt to harvest the crop in front of the bot. public bool Harvest() { if (farmer == null) { return(false); } farmer.setTileLocation(TileLocation); GameLocation loc = this.currentLocation; int aheadX = (int)position.X + 64 * DxForDirection(farmer.FacingDirection); int aheadY = (int)position.Y + 64 * DyForDirection(farmer.FacingDirection); Vector2 tileLocation = new Vector2(aheadX / 64, aheadY / 64); TerrainFeature feature = null; if (!loc.terrainFeatures.TryGetValue(tileLocation, out feature)) { return(false); } var origPlayer = Game1.player; Game1.player = farmer; bool result = feature.performUseAction(tileLocation, loc); Game1.player = origPlayer; return(result); }
public override void behaviorOnCollisionWithTerrainFeature(TerrainFeature t, Vector2 tileLocation, GameLocation location) { t.performUseAction(tileLocation); this.explosionAnimation(location); }