public void SetTileInfo(Vector2Int position, bool hasActor) { var oldTile = GetTileInfo(position); Tilemap.SetTile(new Vector3Int(position.x, position.y, 0), InfoTile.GetInfoTile(oldTile != null ? oldTile.tileType : InfoTile.TileType.Ground, hasActor) ); }
public InfoTile GetTileInfo(Vector2Int position) { var tile = Tilemap.GetTile <InfoTile>(new Vector3Int(position.x, position.y, 0)); if (tile == null) { tile = InfoTile.GetInfoTile(InfoTile.TileType.Void, false); } return(tile); }
/// <summary> /// 是否可以走在指定类型的Tile当中 /// </summary> /// <param name="infoTile">Tile信息</param> /// <returns></returns> public virtual bool CanMoveIn(InfoTile infoTile) { if (infoTile == null) { return(false); } if (infoTile.hasActor) { return(false); } return(infoTile.tileType == InfoTile.TileType.Ground); }
/// <summary> /// /// </summary> /// <returns></returns> private async Task LoadPanelAsync() { await Task.Run(() => { try { // We must ensure it is globally set before clicking country (https://www.bing.com/covid/*) if (_driver.Url.Count() > _conf.GetSection("SeleniumConfigurations").GetSection("URI").Value.Length) { ClickCloseSelectedCountry(); } // Retrieves stats from clicked country var infoTileElement = ClickCountryAndGetStats($"div#{_currentCountry.ToLower().Trim()}.area"); if (infoTileElement == null) { return; } var barElement = infoTileElement .FindElement(By.ClassName("bar")); var confirmedElement = infoTileElement .FindElement(By.ClassName("confirmed")); var infoTileDataElement = infoTileElement .FindElement(By.ClassName("infoTileData")); var infoTile = new InfoTile(barElement, confirmedElement, infoTileDataElement); var infoTileData = new InfoTileData(infoTile.InfoTileData.FindElements(By.ClassName("legend")).ToArray()); ExtractInfos( new string[] { infoTileData.GetActive(), infoTileData.GetRecovered(), infoTileData.GetDeaths() } ); } catch (Exception exc) { Console.WriteLine($"{exc.Message} - Something went wrong here: {_driver.Url}. But don't worry, we can keep trying at the next Country."); } }); }
public void SetTileInfo(Vector2Int position, InfoTile.TileType tileType, bool hasActor) { Tilemap.SetTile(new Vector3Int(position.x, position.y, 0), InfoTile.GetInfoTile(tileType, hasActor)); }