diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/console/CameraConveyor.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/console/CameraConveyor.java')
| -rw-r--r-- | NET/worlds/console/CameraConveyor.java | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/NET/worlds/console/CameraConveyor.java b/NET/worlds/console/CameraConveyor.java new file mode 100644 index 0000000..c2094db --- /dev/null +++ b/NET/worlds/console/CameraConveyor.java @@ -0,0 +1,124 @@ +/* */ 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<WObject> 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 + */
\ No newline at end of file |