/* */ package NET.worlds.scape; /* */ /* */ import java.io.IOException; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class PostspinBehavior /* */ extends SpinBehavior /* */ implements FrameHandler /* */ { /* */ private float xCenter; /* */ private float yCenter; /* */ private float zCenter; /* */ /* */ public PostspinBehavior(float x, float y, float z, float cycleTime) /* */ { /* 28 */ this(x, y, z, 0.0F, 0.0F, 1.0F, cycleTime); /* */ } /* */ /* */ /* */ public PostspinBehavior(float x, float y, float z, float ax, float ay, float az) /* */ { /* 34 */ this(x, y, z, ax, ay, az, 5.0F); /* */ } /* */ /* */ /* */ public PostspinBehavior(float x, float y, float z, float ax, float ay, float az, float cycleTime) /* */ { /* 40 */ super(cycleTime, ax, ay, az); /* 41 */ this.xCenter = x; /* 42 */ this.yCenter = y; /* 43 */ this.zCenter = z; /* */ } /* */ /* */ /* */ /* */ public PostspinBehavior() {} /* */ /* */ /* */ /* 52 */ public float getXCenter() { return this.xCenter; } /* 53 */ public float getYCenter() { return this.yCenter; } /* 54 */ public float getZCenter() { return this.zCenter; } /* */ /* */ /* 57 */ public Point3Temp getCenter() { return Point3Temp.make(this.xCenter, this.yCenter, this.zCenter); } /* */ /* 59 */ public void setXCenter(float c) { this.xCenter = c; } /* 60 */ public void setYCenter(float c) { this.yCenter = c; } /* 61 */ public void setZCenter(float c) { this.zCenter = c; } /* */ /* */ public void setCenter(Point3Temp center) { /* 64 */ this.xCenter = center.x; /* 65 */ this.yCenter = center.y; /* 66 */ this.zCenter = center.z; /* */ } /* */ /* */ public boolean handle(FrameEvent e) /* */ { /* 71 */ if ((this.enabled) && (this.cycleTime > 0.0F)) /* */ { /* 73 */ e.receiver.moveBy(-this.xCenter, -this.yCenter, -this.zCenter); /* 74 */ e.receiver.postspin(this.ax, this.ay, this.az, 0.36F * e.dt / this.cycleTime); /* 75 */ e.receiver.moveBy(this.xCenter, this.yCenter, this.zCenter); /* */ } /* 77 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ public Object properties(int index, int offset, int mode, Object value) /* */ throws NoSuchPropertyException /* */ { /* 86 */ Object ret = null; /* 87 */ switch (index - offset) { /* */ case 0: /* 89 */ if (mode == 0) { /* 90 */ ret = Point3PropertyEditor.make( /* 91 */ new Property(this, index, "Center")); /* 92 */ } else if (mode == 1) { /* 93 */ ret = new Point3(getCenter()); /* 94 */ } else if (mode == 2) /* 95 */ setCenter((Point3)value); /* 96 */ break; /* */ default: /* 98 */ ret = super.properties(index, offset + 1, mode, value); /* */ } /* 100 */ return ret; /* */ } /* */ /* */ public String toString() /* */ { /* 105 */ return /* */ /* */ /* 108 */ super.toString() + "[center " + getCenter() + ", axis " + getAxis() + ", cycleTime " + this.cycleTime + ", enabled " + this.enabled + "]"; /* */ } /* */ /* 111 */ private static Object classCookie = new Object(); /* */ /* */ public void saveState(Saver s) throws IOException /* */ { /* 115 */ s.saveVersion(0, classCookie); /* 116 */ super.saveState(s); /* 117 */ s.saveFloat(this.xCenter); /* 118 */ s.saveFloat(this.yCenter); /* 119 */ s.saveFloat(this.zCenter); /* */ } /* */ /* */ public void restoreState(Restorer r) throws IOException, TooNewException /* */ { /* 124 */ switch (r.restoreVersion(classCookie)) { /* */ case 0: /* 126 */ super.restoreState(r); /* 127 */ this.xCenter = r.restoreFloat(); /* 128 */ this.yCenter = r.restoreFloat(); /* 129 */ this.zCenter = r.restoreFloat(); /* 130 */ break; /* */ default: /* 132 */ throw new TooNewException(); /* */ } /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\PostspinBehavior.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */