Пример #1
0
    public Vector2i?RegisterPawn(PawnControler pawnControler)
    {
        Vector2i gridCoordinate = HexagonUtils.ConvertOrthonormalToHexaSpace(pawnControler.transform.position);

        if (HexData.Contains(gridCoordinate))
        {
            HexData[gridCoordinate].LocalPawns.Add(pawnControler);
            return(gridCoordinate);
        }

        return(null);
    }
Пример #2
0
    public bool EditHexagon(Vector3 initialWorldCoordinate, Vector3 endWorldCoordinate,
                            int typeID, float height, PaintLayer paintLayer)
    {
        bool     isDirty = false;
        Vector2i initialGridCoordinate = HexagonUtils.ConvertOrthonormalToHexaSpace(initialWorldCoordinate);
        Vector2i endGridCoordinate     = HexagonUtils.ConvertOrthonormalToHexaSpace(endWorldCoordinate);

        IEnumerable <Vector2i> line = HexagonUtils.GetLine(initialGridCoordinate, endGridCoordinate);

        foreach (Vector2i gridCoordinate in line)
        {
            isDirty |= EditHexagon(gridCoordinate, typeID, height, paintLayer);
        }
        return(isDirty);
    }
Пример #3
0
    public bool EditHexagon(Vector3 worldCoordinate, int typeID, float height, PaintLayer paintLayer)
    {
        Vector2i gridCoordinate = HexagonUtils.ConvertOrthonormalToHexaSpace(worldCoordinate);

        return(EditHexagon(gridCoordinate, typeID, height, paintLayer));
    }