示例#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
    bool EditHexagon(Vector2i gridCoordinate, int typeID, float height, PaintLayer paintLayer)
    {
        //Debug.Log("gridCoordinate: " + gridCoordinate);
        bool isDirty = false;

        if (HexData.Contains(gridCoordinate))
        {
            if (paintLayer.Contain(PaintLayer.Type) && HexData[gridCoordinate].TypeID != typeID)
            {
                HexData[gridCoordinate].TypeID = typeID;
                isDirty |= true;
            }
            if (paintLayer.Contain(PaintLayer.Height) && HexData[gridCoordinate].Height != height)
            {
                HexData[gridCoordinate].Height = height;
                isDirty |= true;
            }
            _chunks[gridCoordinate.y / chunkLength * ChunkRow + gridCoordinate.x / chunkWidth].IsDirty |= isDirty;
        }
        return(isDirty);
    }
示例#3
0
 public bool Contains(Vector2i location)
 {
     return(HexData.Contains(location));
 }