/** Destroys both portals. */ public void destroyPortals() { if (bluePortal != null) { level.addToRemove(bluePortal); bluePortal = null; } if (orangePortal != null) { level.addToRemove(orangePortal); orangePortal = null; } }
/** Creates a Portal of the specified color */ private void createPortal(PortalColor color) { Portal portal = getPortal(color); if (portal == null) { portal = new Portal(level, raycast.getPosition(), color, raycast.getPortalNormal()); level.add(portal); setPortal(portal); linkPortals(); } else { portal.setPosition(raycast.getPosition()); portal.setNormal(raycast.getPortalNormal()); } }
public PortalGun(Level level, Entity owner) { super(level.getWorld(), owner); this.level = level; this.raycast = new PortalGunRayCast(level.getWorld()); }