package NET.worlds.scape; import NET.worlds.core.Std; import java.util.Enumeration; public class MoveCameraAction extends MoveAction { private static Object classCookie = new Object(); @Override public Persister trigger(Event e, Persister seqID) { Pilot pl = Pilot.getActive(); if (!(pl instanceof HoloPilot)) { return null; } else { HoloPilot holo = (HoloPilot)pl; holo.releaseCamera(); Object owner = holo.getCamera(); if (owner != null && owner instanceof WObject) { WObject o = (WObject)owner; if (this.killed) { this.killed = false; this.activeID = null; holo.reclaimCamera(); return null; } else { if (seqID == null) { if (this.activeID != null) { return this.activeID; } if (this.killOthers) { Enumeration acts = o.getActions(); while (acts.hasMoreElements()) { Action a = (Action)acts.nextElement(); if (a != this && a instanceof MoveAction) { MoveAction ma = (MoveAction)a; if (ma.isRunning()) { ma.kill(); } } } } this.startTime = Std.getRealTime(); this.activeID = new SuperRoot(); seqID = this.activeID; } if (seqID != this.activeID) { return null; } else { int currentTime = Std.getRealTime(); int cycleNo = (currentTime - this.startTime) / this.cycleTime; float frameLoc = 1.0F; if (cycleNo >= this.cycles && !this.loopInfinite) { System.out.println("Killing MoveCameraAction. loopInfinite = " + this.loopInfinite); this.activeID = null; } else { frameLoc = (float)((currentTime - this.startTime) % this.cycleTime) / this.cycleTime; } o.makeIdentity(); o.spin(this.extentSpin, this.extentRotation * frameLoc); o.spin(this.startSpin, this.startRotation); Point3Temp p = Point3Temp.make( (float)Math.pow(this.extentScale.x, frameLoc), (float)Math.pow(this.extentScale.y, frameLoc), (float)Math.pow(this.extentScale.z, frameLoc) ); o.scale(p.times(this.startScale)); o.moveTo(Point3Temp.make(this.extentPoint).times(frameLoc).plus(this.startPoint)); if (this.activeID == null) { holo.reclaimCamera(); } return this.activeID; } } } else { return null; } } } }