/// <summary>Get the updated data layer tiles.</summary> /// <param name="location">The current location.</param> /// <param name="visibleArea">The tiles currently visible on the screen.</param> /// <param name="cursorTile">The tile position under the cursor.</param> public override IEnumerable <TileGroup> Update(GameLocation location, Rectangle visibleArea, Vector2 cursorTile) { // update cache on location change if (this.LastLocation == null || !object.ReferenceEquals(location, this.LastLocation)) { this.LastLocation = location; this.WaterTiles.Clear(); this.TilesInRange.Clear(); int mapWidth = location.Map.Layers.Max(p => p.LayerWidth); int mapHeight = location.Map.Layers.Max(p => p.LayerHeight); for (int x = 0; x < mapWidth; x++) { for (int y = 0; y < mapHeight; y++) { if (location.isOpenWater(x, y)) { this.WaterTiles.Add(new Vector2(x, y)); } } } } // get paddy tiles Vector2[] visibleTiles = visibleArea.GetTiles().ToArray(); HashSet <Vector2> tilesInRange = new HashSet <Vector2>(this.GetTilesInRange(visibleTiles)); yield return(new TileGroup(tilesInRange.Select(pos => new TileData(pos, this.InRange)).ToArray(), outerBorderColor: this.InRange.Color)); yield return(new TileGroup(visibleTiles.Where(pos => !tilesInRange.Contains(pos)).Select(pos => new TileData(pos, this.NotInRange)).ToArray())); }
/// <summary>Get the updated data layer tiles.</summary> /// <param name="location">The current location.</param> /// <param name="visibleArea">The tiles currently visible on the screen.</param> /// <param name="cursorTile">The tile position under the cursor.</param> public override IEnumerable <TileGroup> Update(GameLocation location, Rectangle visibleArea, Vector2 cursorTile) { Vector2[] visibleTiles = visibleArea.GetTiles().ToArray(); yield return(this.GetGroup(location, visibleTiles, HoeDirt.watered, this.WateredColor)); yield return(this.GetGroup(location, visibleTiles, HoeDirt.dry, this.DryColor)); }
/// <summary>Get the updated data layer tiles.</summary> /// <param name="location">The current location.</param> /// <param name="visibleArea">The tiles currently visible on the screen.</param> /// <param name="cursorTile">The tile position under the cursor.</param> public override IEnumerable <TileGroup> Update(GameLocation location, Rectangle visibleArea, Vector2 cursorTile) { TileData[] tiles = this.GetTiles(location, visibleArea.GetTiles().ToArray()).ToArray(); yield return(new TileGroup(tiles.Where(p => p.Type.Id == this.Ready.Id), outerBorderColor: this.Ready.Color)); yield return(new TileGroup(tiles.Where(p => p.Type.Id == this.NotReady.Id))); yield return(new TileGroup(tiles.Where(p => p.Type.Id == this.NotEnoughTime.Id), outerBorderColor: this.NotEnoughTime.Color)); }
/// <summary>Get the updated data layer tiles.</summary> /// <param name="location">The current location.</param> /// <param name="visibleArea">The tiles currently visible on the screen.</param> /// <param name="cursorTile">The tile position under the cursor.</param> public override IEnumerable <TileGroup> Update(GameLocation location, Rectangle visibleArea, Vector2 cursorTile) { Vector2[] visibleTiles = visibleArea.GetTiles().ToArray(); yield return(this.GetGroup(location, visibleTiles, this.FertilizerColor, HoeDirt.fertilizerLowQuality, HoeDirt.fertilizerHighQuality)); yield return(this.GetGroup(location, visibleTiles, this.SpeedGroColor, HoeDirt.speedGro, HoeDirt.superSpeedGro)); yield return(this.GetGroup(location, visibleTiles, this.RetainingSoilColor, HoeDirt.waterRetentionSoil, HoeDirt.waterRetentionSoilQUality)); }
/// <summary>Get the updated data layer tiles.</summary> /// <param name="location">The current location.</param> /// <param name="visibleArea">The tiles currently visible on the screen.</param> /// <param name="cursorTile">The tile position under the cursor.</param> public override IEnumerable <TileGroup> Update(GameLocation location, Rectangle visibleArea, Vector2 cursorTile) { TileData[] tiles = this.GetTiles(location, visibleArea.GetTiles()).ToArray(); // passable tiles TileData[] passableTiles = tiles.Where(p => p.Type.Id == this.Clear.Id).ToArray(); yield return(new TileGroup(passableTiles, outerBorderColor: this.Clear.Color)); // other tiles yield return(new TileGroup(tiles.Except(passableTiles).ToArray())); }