home *** CD-ROM | disk | FTP | other *** search
/ Level 2000 August / Level_2000-08_cd1.bin / Demos / Vampire / Vampire_Demo.exe / Codex.nob / DoubleDoor.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-22  |  1.9 KB  |  56 lines

  1. public class DoubleDoor extends Codex {
  2.    private CodexThing _door = new CodexThing(((Codex)this).GetClassThing());
  3.    private float _speed = 10.0F;
  4.    private CodexThing _door2;
  5.    private boolean bOpen;
  6.    private boolean bActive;
  7.    public static String[] _params = new String[]{"Movement speed;10.0", "Second half door"};
  8.  
  9.    public void clicked(int guid, int clickerGuid, int captureId) {
  10.       if (!this.bActive) {
  11.          this.bActive = true;
  12.          if (!this.bOpen) {
  13.             this._door.MoveToFrame(1, this._speed);
  14.             this._door2.MoveToFrame(1, this._speed);
  15.             this.bOpen = true;
  16.          } else {
  17.             this._door.MoveToFrame(0, this._speed);
  18.             this._door2.MoveToFrame(0, this._speed);
  19.             this.bOpen = false;
  20.          }
  21.  
  22.       }
  23.    }
  24.  
  25.    public void beginscene(int clientGuid, int captureID) {
  26.       this._door.SetThingFlags(8192);
  27.       this._door2.SetThingFlags(8192);
  28.    }
  29.  
  30.    public void arrived(int thingGuid, int frameNum, int captureId) {
  31.       this.bActive = false;
  32.    }
  33.  
  34.    public DoubleDoor(float speed, CodexThing door2) {
  35.       this._speed = speed;
  36.       this._door2 = new CodexThing(((Codex)door2).GetGUID());
  37.       ((Codex)this).CaptureThing(this._door2.GetGUID());
  38.       if (this._door.GetDescriptionID().equalsIgnoreCase("PROP")) {
  39.          this._door.SetDescriptionID("GEN_DOOR");
  40.       }
  41.  
  42.       if (this._door2.GetDescriptionID().equalsIgnoreCase("PROP")) {
  43.          this._door2.SetDescriptionID("GEN_DOOR");
  44.       }
  45.  
  46.    }
  47.  
  48.    public void restore(int flags) {
  49.       this.bOpen = CodexSequence.RestoreBoolean();
  50.    }
  51.  
  52.    public void save(int flags) {
  53.       CodexSequence.SaveBoolean(this.bOpen);
  54.    }
  55. }
  56.