Package org.freerealm.tile

Examples of org.freerealm.tile.TileType


        WorldMap worldMap = new WorldMap();
        if (useTileType == null) {
            int probabilityTotal = 0;
            Iterator<TileType> tileIterator = realm.getTileTypeManager().getTileTypesIterator();
            while (tileIterator.hasNext()) {
                TileType tileType = tileIterator.next();
                probabilityTotal = probabilityTotal + tileType.getProbability();
            }
            for (int i = 0; i < width; i++) {
                for (int j = 0; j < height; j++) {
                    mapItems[i][j] = new Tile(generateTileType(realm, probabilityTotal));
                }
View Full Code Here


    }

    private TileType generateTileType(Realm realm, int probabilityTotal) {
        int randomNumber = rand.nextInt(probabilityTotal);
        Iterator tileIterator = realm.getTileTypeManager().getTileTypesIterator();
        TileType tileType = null;
        while (tileIterator.hasNext()) {
            tileType = (TileType) tileIterator.next();
            randomNumber = randomNumber - tileType.getProbability();
            if (randomNumber < 0) {
                return tileType;
            }
        }
        return tileType;
View Full Code Here

TOP

Related Classes of org.freerealm.tile.TileType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.