summaryrefslogtreecommitdiff
path: root/NET/worlds/console/Conveyor.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/console/Conveyor.java')
-rw-r--r--NET/worlds/console/Conveyor.java89
1 files changed, 89 insertions, 0 deletions
diff --git a/NET/worlds/console/Conveyor.java b/NET/worlds/console/Conveyor.java
new file mode 100644
index 0000000..b8fa887
--- /dev/null
+++ b/NET/worlds/console/Conveyor.java
@@ -0,0 +1,89 @@
+/* */ package NET.worlds.console;
+/* */
+/* */ import NET.worlds.scape.FrameEvent;
+/* */ import NET.worlds.scape.FrameHandler;
+/* */ import NET.worlds.scape.Point3;
+/* */ import NET.worlds.scape.Point3Temp;
+/* */ import NET.worlds.scape.Restorer;
+/* */ import NET.worlds.scape.Saver;
+/* */ import NET.worlds.scape.SuperRoot;
+/* */ import NET.worlds.scape.TooNewException;
+/* */ import NET.worlds.scape.WObject;
+/* */ import java.io.IOException;
+/* */ import java.util.Enumeration;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class Conveyor
+/* */ extends SuperRoot
+/* */ implements FrameHandler
+/* */ {
+/* */ private Point3 vector;
+/* */
+/* */ public Conveyor(Point3Temp direction, float speed)
+/* */ {
+/* 38 */ this.vector = new Point3(direction.normalize().times(speed));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public Conveyor(Point3Temp v)
+/* */ {
+/* 47 */ this.vector = new Point3(v);
+/* */ }
+/* */
+/* */ public boolean handle(FrameEvent e) {
+/* 51 */ Enumeration<WObject> stuff = e.receiver.getContents();
+/* 52 */ Point3Temp delta = this.vector;
+/* 53 */ delta.times(e.dt / 1000.0F);
+/* */
+/* 55 */ while (stuff.hasMoreElements()) {
+/* 56 */ WObject thing = (WObject)stuff.nextElement();
+/* 57 */ thing.moveThrough(delta);
+/* */ }
+/* 59 */ return true;
+/* */ }
+/* */
+/* 62 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException
+/* */ {
+/* 66 */ s.saveVersion(1, classCookie);
+/* 67 */ super.saveState(s);
+/* 68 */ s.save(this.vector);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException
+/* */ {
+/* 73 */ switch (r.restoreVersion(classCookie)) {
+/* */ case 1:
+/* 75 */ super.restoreState(r);
+/* */ case 0:
+/* 77 */ this.vector = ((Point3)r.restore());
+/* 78 */ break;
+/* */ default:
+/* 80 */ throw new TooNewException();
+/* */ }
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\Conveyor.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file