Ejemplo n.º 1
0
    //判断一个障碍是否具有某种属性 例如way fullway startpoint endpoint 都具有way的属性
    protected bool IsPointType(int i, int j, MazeCreate.PointType type)
    {
        if (i < 0 || i >= mazeCreate.mapList.Count)
        {
            return(false);
        }
        if (j < 0 || j >= mazeCreate.mapList[i].Count)
        {
            return(false);
        }

        return((mazeCreate.mapList[i][j] & (int)type) == (int)type);
    }
Ejemplo n.º 2
0
    protected int GetMaxFullSpace(int i, int j, MazeCreate.PointType type)
    {
        int z = 0;

        while (true)
        {
            z++;
            if (i + z >= row || j + z >= col)
            {
                break;
            }
            bool isfull = true;
            for (int x = 0; x <= z; x++)
            {
                int val1 = mazeCreate.mapList[i + x][j + z];
                int val2 = mazeCreate.mapList[i + x][j];
                if (val1 == (int)type && val2 == (int)type)
                {
                }
                else
                {
                    isfull = false;
                    break;
                }
            }
            if (!isfull)
            {
                break;
            }

            for (int y = 0; y <= z; y++)
            {
                int val1 = mazeCreate.mapList[i + z][j + y];
                int val2 = mazeCreate.mapList[i][j + y];
                if (val1 == (int)type && val2 == (int)type)
                {
                }
                else
                {
                    isfull = false;
                    break;
                }
            }
            if (!isfull)
            {
                break;
            }
        }
        return(z);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Opens the unit.
    /// </summary>
    /// <param name="x">The x coordinate.</param>
    /// <param name="y">The y coordinate.</param>
    /// <param name="type">Type.</param>
    public void OpenUnit(int x, int y, MazeCreate.PointType type)
    {
        if (dataArray[x, y] != MazeCreate.PointType.non)
        {
            return;
        }
        //Debug.Log("OpenUnit : " + x + " y:"+ y);
        dataArray[x, y] = type;
        updateData      = true;

        int w = x * unitSize;
        int h = y * unitSize;

        SetPixel(w, h, type);
    }
Ejemplo n.º 4
0
    //根据type绘制某一位置信息
    void SetPixel(int x, int y, MazeCreate.PointType type)
    {
        if (dataArray[x, y] == MazeCreate.PointType.non)
        {
            return;
        }
        Color c = mapColors[type];

        for (int i = 0; i < unitSize; i++)
        {
            for (int j = 0; j < unitSize; j++)
            {
                mapTexture.SetPixel(x + i, y + j, c);
            }
        }
    }
Ejemplo n.º 5
0
 public InGameMapPointData(MazeCreate.PointType type, Vector2 pos)
 {
     this.type = type;
     this.pos  = pos;
 }