Exemple #1
0
    public void setSkillFilter(HexCoordinates coordinate, int size, int action)
    {
        if (hexFilter != null)
        {
            clearHexFilter();
        }
        hexFilter = Instantiate <HexFilter>(hexFilterPrefab);
        hexFilter.transform.SetParent(transform, false);

        for (int x = -size; x <= size; x++)
        {
            int iX = x + coordinate.X;

            if ((iX < 0 || iX >= width))
            {
                continue;
            }
            for (int y = Mathf.Max(-size, -x - size); y <= Mathf.Min(size, -x + size); y++)
            {
                int iY = y + coordinate.Y;

                if (((iY + iX / 2) < 0 || (iY + iX / 2) >= height))
                {
                    continue;
                }

                int index = iX + (iY + iX / 2) * width;

                if (cells[index] != null && (cells[index].mapType != 1 && cells[index].mapType != 2))
                {
                    hexFilter.setFilter(HexCoordinates.FromOffsetCoordinates(iX, iY + iX / 2), action);
                }
            }
        }
    }
Exemple #2
0
    void CreateCell(int x, int y, int i)
    {
        if (mapDetail.detail[i] == 0)
        {
            return;
        }

        Vector3 position;

        position.x = x * (HexMetrics.outerRadius * 1.5f);
        position.y = -y - ((float)i % 4 / 4f);
        position.z = (y + x * 0.5f - x / 2) * (HexMetrics.innerRadius * 2f);

        HexCell cell = cells[i] = Instantiate <HexCell>(cellPrefab); //cell is referent to cells[]

        cell.transform.SetParent(transform, false);
        cell.transform.localPosition = position;
        cell.coordinates             = HexCoordinates.FromOffsetCoordinates(x, y);
        cell.setType(mapDetail.detail[i] % 4);
        cell.setMap(maps[cell.mapType]);

        if (cell.mapType == 1 || cell.mapType == 2)
        {
            return;
        }

        if (PhotonNetwork.isMasterClient)
        {
            if (cell.coordinates.Y < mapDetail.area[0])
            {
                hexFilter.setFilter(cell.coordinates, 1);
            }
        }
        else
        {
            if (cell.coordinates.Y > mapDetail.area[1])
            {
                hexFilter.setFilter(cell.coordinates, 1);
            }
        }
    }
Exemple #3
0
    public List <HexCoordinates> setMoveFilter(HexCoordinates coordinate, int size)
    {
        if (hexFilter != null)
        {
            clearHexFilter();
        }
        hexFilter = Instantiate <HexFilter>(hexFilterPrefab);
        hexFilter.transform.SetParent(transform, false);

        List <HexCoordinates> coordinates = canMoveCoordinates(coordinate, 0, size);

        for (int i = 0; i < coordinates.Count; i++)
        {
            hexFilter.setFilter(coordinates[i], 1);
        }

        return(coordinates);
    }