Progress on Maze Generation

* Finished implementing link planning for mazes. Doors aren't placed yet
because that's up to Decorators and those haven't been implemented yet.
* Added bounding walls to mazes.
* Added decay effects to mazes.
This commit is contained in:
SenseiKiwi
2014-04-14 22:24:59 -04:00
parent 906faf44eb
commit 81b48158bd
7 changed files with 544 additions and 122 deletions

View File

@@ -1,52 +1,47 @@
package StevenDimDoors.experimental;
import StevenDimDoors.mod_pocketDim.Point3D;
public class LinkPlan
{
private RoomData source;
private RoomData destination;
private boolean entrance;
private Point3D sourcePoint;
private Point3D destinationPoint;
private final boolean entrance;
private final boolean internal;
private LinkPlan(RoomData source, RoomData destination, boolean entrance)
{
this.source = source;
this.destination = destination;
this.entrance = entrance;
}
public static LinkPlan createInternalLink(RoomData source, RoomData destination)
private LinkPlan(RoomData source, boolean entrance, boolean internal)
{
if (source == null)
{
throw new IllegalArgumentException("source cannot be null.");
}
if (destination == null)
{
throw new IllegalArgumentException("destination cannot be null.");
}
LinkPlan plan = new LinkPlan(source, destination, false);
this.source = source;
this.destination = null;
this.sourcePoint = null;
this.destinationPoint = null;
this.entrance = entrance;
this.internal = internal;
}
public static LinkPlan createInternalLink(RoomData source)
{
LinkPlan plan = new LinkPlan(source, false, true);
source.getOutboundLinks().add(plan);
destination.getInboundLinks().add(plan);
return plan;
}
public static LinkPlan createEntranceLink(RoomData source)
{
if (source == null)
{
throw new IllegalArgumentException("source cannot be null.");
}
LinkPlan plan = new LinkPlan(source, null, true);
LinkPlan plan = new LinkPlan(source, true, false);
source.getOutboundLinks().add(plan);
return plan;
}
public static LinkPlan createDungeonLink(RoomData source)
{
if (source == null)
{
throw new IllegalArgumentException("source cannot be null.");
}
LinkPlan plan = new LinkPlan(source, null, false);
LinkPlan plan = new LinkPlan(source, false, false);
source.getOutboundLinks().add(plan);
return plan;
}
@@ -68,7 +63,7 @@ public class LinkPlan
public boolean isInternal()
{
return (destination != null);
return internal;
}
public void remove()
@@ -84,4 +79,42 @@ public class LinkPlan
destination = null;
}
}
public void setDestination(RoomData destination)
{
if (!internal)
{
throw new IllegalStateException("LinkPlan.setDestination() is only applicable to internal links.");
}
if (this.destination != null)
{
throw new IllegalStateException("destination can only be set once.");
}
if (destination == null)
{
throw new IllegalArgumentException("destination cannot be null.");
}
this.destination = destination;
destination.getInboundLinks().add(this);
}
public Point3D sourcePoint()
{
return this.sourcePoint;
}
public Point3D destinationPoint()
{
return this.destinationPoint;
}
public void setSourcePoint(Point3D value)
{
this.sourcePoint = value;
}
public void setDestinationPoint(Point3D value)
{
this.destinationPoint = value;
}
}