Esempio n. 1
0
    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);
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    void UpdateCampVision()
    {
        campVision = HexagonUtils.NeighborHexagons(campCoord, 2);
        campVision.Add(campCoord);
        MapManager.Instance.RemoveHexagonsNotExists(campVision);

        if (isLocalPlayer)
        {
            visionController.SetCampVision(campVision);
            visionController.RecalcVision();
        }
    }
Esempio n. 4
0
    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);
    }
Esempio n. 5
0
    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);
    }