/* */ package NET.worlds.scape; /* */ /* */ import java.io.IOException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class SpinBehavior /* */ extends SwitchableBehavior /* */ implements FrameHandler /* */ { /* */ protected float cycleTime; /* */ protected float ax; /* */ protected float ay; /* */ protected float az; /* */ /* */ public SpinBehavior() /* */ { /* 31 */ this(5.0F); /* */ } /* */ /* */ public SpinBehavior(float cycleTime) /* */ { /* 36 */ this(cycleTime, 0.0F, 0.0F, 1.0F); /* */ } /* */ /* */ public SpinBehavior(Point3Temp axis) /* */ { /* 41 */ this(5.0F, axis); /* */ } /* */ /* */ public SpinBehavior(float ax, float ay, float az) /* */ { /* 46 */ this(5.0F, ax, ay, az); /* */ } /* */ /* */ public SpinBehavior(float cycleTime, Point3Temp axis) /* */ { /* 51 */ this(cycleTime, axis.x, axis.y, axis.z); /* */ } /* */ /* */ public SpinBehavior(float cycleTime, float ax, float ay, float az) /* */ { /* 56 */ this.cycleTime = cycleTime; /* 57 */ this.ax = ax; /* 58 */ this.ay = ay; /* 59 */ this.az = az; /* */ } /* */ /* */ /* */ /* */ /* 65 */ public float getCycleTime() { return this.cycleTime; } /* 66 */ public void setCycleTime(float t) { this.cycleTime = t; } /* */ /* 68 */ public Point3Temp getAxis() { return Point3Temp.make(this.ax, this.ay, this.az); } /* */ /* */ public void setAxis(Point3Temp axis) { /* 71 */ this.ax = axis.x; /* 72 */ this.ay = axis.y; /* 73 */ this.az = axis.z; /* */ } /* */ /* */ public boolean handle(FrameEvent e) /* */ { /* 78 */ if ((this.enabled) && (this.cycleTime > 0.0F)) /* 79 */ e.receiver.spin(this.ax, this.ay, this.az, 0.36F * e.dt / this.cycleTime); /* 80 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 89 */ Object ret = null; /* 90 */ switch (index - offset) { /* */ case 0: /* 92 */ if (mode == 0) { /* 93 */ ret = FloatPropertyEditor.make( /* 94 */ new Property(this, index, "Cycle Time")); /* 95 */ } else if (mode == 1) { /* 96 */ ret = new Float(this.cycleTime); /* 97 */ } else if (mode == 2) /* 98 */ this.cycleTime = ((Float)value).floatValue(); /* 99 */ break; /* */ case 1: /* 101 */ if (mode == 0) { /* 102 */ ret = Point3PropertyEditor.make( /* 103 */ new Property(this, index, "Axis")); /* 104 */ } else if (mode == 1) { /* 105 */ ret = new Point3(getAxis()); /* 106 */ } else if (mode == 2) /* 107 */ setAxis((Point3)value); /* 108 */ break; /* */ default: /* 110 */ ret = super.properties(index, offset + 2, mode, value); /* */ } /* 112 */ return ret; /* */ } /* */ /* */ public String toString() /* */ { /* 117 */ return /* */ /* 119 */ super.toString() + "[axis " + getAxis() + ", cycleTime " + this.cycleTime + ", enabled " + this.enabled + "]"; /* */ } /* */ /* 122 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 126 */ s.saveVersion(0, classCookie); /* 127 */ s.saveFloat(this.cycleTime); /* 128 */ s.saveFloat(this.ax); /* 129 */ s.saveFloat(this.ay); /* 130 */ s.saveFloat(this.az); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 135 */ switch (r.restoreVersion(classCookie)) { /* */ case 0: /* 137 */ this.cycleTime = r.restoreFloat(); /* 138 */ this.ax = r.restoreFloat(); /* 139 */ this.ay = r.restoreFloat(); /* 140 */ this.az = r.restoreFloat(); /* 141 */ break; /* */ default: /* 143 */ throw new TooNewException(); /* */ } /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\SpinBehavior.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */