home *** CD-ROM | disk | FTP | other *** search
- public class DoorRegion extends Codex {
- private float _speed = 10.0F;
- private float _openTime;
- private CodexRegion _triggerDoorRegion;
- private CodexThing door;
- private int doorGuid;
- private int _OpenOnce;
- private boolean bOpen;
- private boolean bActive;
- public static String[] _params = new String[]{"Movement speed;150.0", "Open Time;0", "Open Once;0", "Region"};
-
- public void beginscene(int clientGuid, int captureID) {
- this.door.SetThingFlags(8192);
- }
-
- public void arrived(int thingGuid, int frameNum, int captureId) {
- this.bOpen = frameNum != 0;
- if (this.bOpen && (double)this._openTime > (double)0.0F) {
- ((Codex)this).SetTimer(this._openTime);
- } else if (this._OpenOnce == 0) {
- this.bActive = false;
- } else if (this._OpenOnce == 1) {
- this.door.SetThingFlags(64);
- }
-
- if (!this.bOpen) {
- this.bActive = false;
- }
-
- }
-
- public void restore(int flags) {
- this.bOpen = CodexSequence.RestoreBoolean();
- }
-
- public void entered(int guid, int causeGUID, int captureID) {
- if (Codex.IsActorGuid(causeGUID)) {
- if (!this.bActive) {
- this.bActive = true;
- if (!this.bOpen) {
- this.door.MoveToFrame(1, this._speed);
- this.bOpen = true;
- } else {
- this.door.MoveToFrame(0, this._speed);
- this.bOpen = false;
- }
-
- }
- }
- }
-
- public void save(int flags) {
- CodexSequence.SaveBoolean(this.bOpen);
- }
-
- public void timer(int timerID, float arg0, float arg1, float arg2, float arg3) {
- if (this.bOpen) {
- this.door.MoveToFrame(0, this._speed);
- this.bOpen = false;
- }
-
- }
-
- public DoorRegion(float speed, float openTime, int OpenOnce, CodexThing triggerDoorRegion) {
- this._speed = speed;
- this._openTime = openTime;
- this._triggerDoorRegion = new CodexRegion(((Codex)triggerDoorRegion).GetGUID());
- this._OpenOnce = OpenOnce;
- ((Codex)this).CaptureThing(this._triggerDoorRegion.GetGUID());
- this.doorGuid = ((Codex)this).GetClassThing();
- this.door = new CodexThing(this.doorGuid);
- if (this.door.GetDescriptionID().equalsIgnoreCase("PROP")) {
- this.door.SetDescriptionID("GEN_DOOR");
- }
-
- }
- }
-