public static HashSet <HexCoord> GetRangeOfTower(TowerInfo tower, HashSet <HexCoord> vision) { var range = HexagonUtils.NeighborHexagons(tower.coord, tower.range); range.IntersectWith(vision); MapManager.Instance.RemoveHexagonsNotExists(range); return(range); }
public static HashSet <HexCoord> GetRange(HexCoord center, int range, HashSet <HexCoord> vision) { var ret = HexagonUtils.NeighborHexagons(center, range); ret.IntersectWith(vision); MapManager.Instance.RemoveHexagonsNotExists(ret); return(ret); }
void UpdateCampVision() { campVision = HexagonUtils.NeighborHexagons(campCoord, 2); campVision.Add(campCoord); MapManager.Instance.RemoveHexagonsNotExists(campVision); if (isLocalPlayer) { visionController.SetCampVision(campVision); visionController.RecalcVision(); } }
public void AddTower(TowerInfo t) { if (t.type != TowerType.VisionTower) { return; } if (!visionTowers.Contains(t)) { visionTowers.Add(t); } var v = HexagonUtils.NeighborHexagons(t.coord, t.vision); v.Add(t.coord); MapManager.Instance.RemoveHexagonsNotExists(v); Vision.UnionWith(v); }
public HashSet <HexCoord> GetHexagonsInRange(int playerSlotId, TowerType type, Func <TowerInfo, int> rangeFunc) { HashSet <HexCoord> ret = new HashSet <HexCoord>(); var towerList = GetTowersOfType(playerSlotId, type); foreach (var t in towerList) { if (MapManager.Instance.Exists(t.coord)) { ret.Add(t.coord); } var set = HexagonUtils.NeighborHexagons(t.coord, rangeFunc(t)); MapManager.Instance.RemoveHexagonsNotExists(set); ret.UnionWith(set); } return(ret); }