コード例 #1
0
    private void SetTileTextureSelfMapCreation(TDTile tile, int tileType, int x, int z)
    {
        // start & stop tile can not be overwritten
        if (tile.GetTileType() == (int)TILE_TYPE.STARTPOINT || tile.GetTileType() == (int)TILE_TYPE.ENDPOINT)
        {
            return;
        }

        tile.SetTileType(tileType);

        texture.SetPixels(x * tileResolution, z * tileResolution, tileResolution, tileResolution, spriteArray[tileType]);
        //texture.SetPixels(x * tileResolution, z * tileResolution, tileResolution, tileResolution, tilePixels[tileType]);
        texture.Apply();
    }
コード例 #2
0
    private void SetTileTexture(TDTile tile, int tileType, int x, int z)
    {
        // we don't need to set old tile type if current type is PATH_PAST or PATH_CURRENT
        if (tile.GetTileType() != (int)TILE_TYPE.PATH_NEXT && tile.GetTileType() != (int)TILE_TYPE.PATH_CURRENT)
        {
            tile.SetOldTileType(tile.GetTileType());
        }
        tile.SetTileType(tileType);

        if (tileType == (int)TILE_TYPE.STARTPOINT)
        {
            map.SetStartPoint(tile);
        }
        else if (tileType == (int)TILE_TYPE.ENDPOINT)
        {
            map.SetEndPoint(tile);
        }

        texture.SetPixels(x * tileResolution, z * tileResolution, tileResolution, tileResolution, spriteArray[tileType]);
        //texture.SetPixels(x * tileResolution, z * tileResolution, tileResolution, tileResolution, tilePixels[tileType]);
        texture.Apply();
    }