/* */ package NET.worlds.console; /* */ /* */ import NET.worlds.scape.FrameEvent; /* */ import NET.worlds.scape.FrameHandler; /* */ import NET.worlds.scape.NoSuchPropertyException; /* */ import NET.worlds.scape.Pilot; /* */ import NET.worlds.scape.Point3; /* */ import NET.worlds.scape.Point3Temp; /* */ import NET.worlds.scape.Property; /* */ 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 CameraConveyor /* */ extends SuperRoot /* */ implements FrameHandler /* */ { /* */ private Point3 vector; /* */ /* */ public CameraConveyor() {} /* */ /* */ public CameraConveyor(Point3Temp direction, float speed) /* */ { /* 46 */ this.vector = new Point3(direction.normalize().times(speed)); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public CameraConveyor(Point3Temp v) /* */ { /* 55 */ this.vector = new Point3(v); /* */ } /* */ /* */ public boolean handle(FrameEvent e) { /* 59 */ if (e.dt == 0) /* 60 */ return true; /* 61 */ Enumeration stuff = e.receiver.getContents(); /* */ /* 63 */ Point3Temp delta = Point3Temp.make(this.vector); /* 64 */ delta.times(e.dt / 1000.0F); /* */ /* 66 */ while (stuff.hasMoreElements()) { /* 67 */ WObject thing = (WObject)stuff.nextElement(); /* 68 */ if ((thing instanceof Pilot)) { /* 69 */ thing.moveThrough(delta); /* */ } /* */ } /* 72 */ return true; /* */ } /* */ /* 75 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 79 */ s.saveVersion(1, classCookie); /* 80 */ super.saveState(s); /* 81 */ s.save(this.vector); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 86 */ switch (r.restoreVersion(classCookie)) { /* */ case 1: /* 88 */ super.restoreState(r); /* */ case 0: /* 90 */ this.vector = ((Point3)r.restore()); /* 91 */ break; /* */ default: /* 93 */ throw new TooNewException(); /* */ } /* */ /* */ } /* */ /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 103 */ Object ret = null; /* */ /* 105 */ switch (index - offset) { /* */ case 0: /* 107 */ if (mode == 0) { /* 108 */ ret = new Property(this, index, "Velocity"); /* 109 */ } else if (mode == 1) /* 110 */ ret = this.vector; /* 111 */ break; /* */ default: /* 113 */ ret = super.properties(index, offset + 1, mode, value); /* */ } /* */ /* 116 */ return ret; /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\console\CameraConveyor.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */