Dungeon.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:Loot-Slash-Conquer 作者:
/**
 * Generates a stores potential room positions off of the current template. Note: this does not take into account existing rooms. Check for existing rooms when spawning each specific room position.
 * @param currentTemplate
 */
private List<DungeonRoomPosition> generatePotentialRooms(TemplateManager manager, World world, Template currentTemplate, Rotation currentTemplateRotation, BlockPos currentCenter, Rotation currentSide)
{
    List<DungeonRoomPosition> list = Lists.newArrayList();

    //Rotation side = Rotation.values()[(int) (Math.random() * 4)];
    for (Rotation side : Rotation.values())
    {
        Template nextTemplate = DungeonHelper.getRandomizedDungeonTemplate(manager, world);
        Rotation nextTemplateRotation = Rotation.values()[(int) (Math.random() * 4)];
        BlockPos centeredPosition = DungeonHelper.translateToNextRoom(currentTemplate, nextTemplate, currentCenter, side, currentTemplateRotation, nextTemplateRotation);
        StructureBoundingBox boundingBox = DungeonHelper.getStructureBoundingBox(nextTemplate, nextTemplateRotation, centeredPosition);

        if (currentSide == null || (currentSide != null && currentSide.add(Rotation.CLOCKWISE_180) != side)) // check to make sure we aren't spawning a room on the side we just spawned from.
        {
            list.add(new DungeonRoomPosition(centeredPosition, nextTemplate, nextTemplateRotation, side, boundingBox));
        }
    }

    return list;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号