Exemple #1
0
    private void SetLastTile(Vector2 currentTileCoords)
    {
        int    x = (int)lastTileCoords.x;
        int    z = (int)lastTileCoords.y;
        TDTile lastTileObject = map.GetTile(x, z);

        if (lastTileObject == null)
        {
            return;
        }

        // set last tile to old type
        // if last tile is start or endpoint --> assign ground
        int newTileType = lastTileObject.GetOldTileType();

        if (newTileType == (int)TILE_TYPE.STARTPOINT || newTileType == (int)TILE_TYPE.ENDPOINT || newTileType == -1)
        {
            newTileType = (int)TILE_TYPE.GROUND;
        }

        // set last tile to current tile
        lastTileCoords = currentTileCoords;

        SetTileTexture(lastTileObject, newTileType, x, z);
    }