summaryrefslogtreecommitdiff
path: root/NET/worlds/console/Conveyor.java
blob: b8fa88721695ff689a02a905228da411cc93caba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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
 */