summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/CameraHeightAction.java
blob: ad2e7b20f55258245f6a96ce679165a57fa064fe (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*     */ package NET.worlds.scape;
/*     */ 
/*     */ import java.io.IOException;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class CameraHeightAction
/*     */   extends Action
/*     */ {
/*     */   public float newEyeHeight;
/*     */   
/*     */   public CameraHeightAction()
/*     */   {
/*  24 */     this.newEyeHeight = 0.0F;
/*     */   }
/*     */   
/*     */ 
/*     */   public Persister trigger(Event e, Persister seqID)
/*     */   {
/*  30 */     Object owner = getOwner();
/*  31 */     if ((owner == null) || (!(owner instanceof WObject))) {
/*  32 */       return null;
/*     */     }
/*  34 */     WObject o = (WObject)owner;
/*     */     
/*  36 */     Pilot pilot = Pilot.getActive();
/*  37 */     if (pilot == null) {
/*  38 */       return null;
/*     */     }
/*     */     
/*  41 */     if (pilot.getRoom() != o.getRoom()) {
/*  42 */       return null;
/*     */     }
/*  44 */     if ((pilot instanceof HoloPilot))
/*     */     {
/*  46 */       HoloPilot hp = (HoloPilot)pilot;
/*  47 */       hp.setEyeHeight(this.newEyeHeight);
/*     */     }
/*     */     
/*  50 */     return null;
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   public Object properties(int index, int offset, int mode, Object value)
/*     */     throws NoSuchPropertyException
/*     */   {
/*  59 */     Object ret = null;
/*  60 */     switch (index - offset) {
/*     */     case 0: 
/*  62 */       if (mode == 0)
/*     */       {
/*  64 */         ret = FloatPropertyEditor.make(
/*  65 */           new Property(this, index, "New Eye Height"));
/*     */       }
/*  67 */       else if (mode == 1)
/*     */       {
/*  69 */         ret = new Float(this.newEyeHeight);
/*     */       }
/*  71 */       else if (mode == 2)
/*     */       {
/*  73 */         this.newEyeHeight = ((Float)value).floatValue();
/*     */       }
/*  75 */       break;
/*     */     
/*     */     default: 
/*  78 */       ret = super.properties(index, offset + 1, mode, value);
/*     */     }
/*     */     
/*  81 */     return ret;
/*     */   }
/*     */   
/*     */   public String toString()
/*     */   {
/*  86 */     return 
/*  87 */       super.toString() + "[New Eye Height: " + this.newEyeHeight + "]";
/*     */   }
/*     */   
/*  90 */   private static Object classCookie = new Object();
/*     */   
/*     */   public void saveState(Saver s) throws IOException
/*     */   {
/*  94 */     s.saveVersion(0, classCookie);
/*  95 */     super.saveState(s);
/*  96 */     s.saveFloat(this.newEyeHeight);
/*     */   }
/*     */   
/*     */   public void restoreState(Restorer r) throws IOException, TooNewException
/*     */   {
/* 101 */     switch (r.restoreVersion(classCookie)) {
/*     */     case 0: 
/* 103 */       super.restoreState(r);
/* 104 */       this.newEyeHeight = r.restoreFloat();
/* 105 */       break;
/*     */     default: 
/* 107 */       throw new TooNewException();
/*     */     }
/*     */   }
/*     */ }


/* Location:              C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\CameraHeightAction.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */