/** * Shoots a blue portal if the gun has no entity grabbed, otherwise throws the entity at the * specified position. */ @Override public void actionLeftClick(Vector2 position) { if (hasEntityGrabbed()) { super.actionLeftClick(position); } else if (raycast.hitPortableSurface()) { createPortal(PortalColor.BLUE); } }
/** * Ray-cast the world every frame using the {@link PortalGunRayCast} callback. * * @see RayCast#process() */ @Override public void update(Vector2 position) { super.update(position); raycast.setRay(owner.getPosition(), position, RAY_CAST_STEP_LENGTH); raycast.process(); }