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

  1. public class SwitchDoubleDoor extends Codex {
  2.    private float _duration = 3.0F;
  3.    private CodexThing _switch = new CodexThing(((Codex)this).GetClassThing());
  4.    private CodexThing _door1;
  5.    private CodexThing _door2;
  6.    private int _frameNum = 1;
  7.    private boolean bOpen;
  8.    private boolean bActive;
  9.    public static String[] _params = new String[]{"Duration;3.0", "First half door", "Second half door"};
  10.  
  11.    public void clicked(int guid, int clickerGuid, int captureId) {
  12.       if (guid != this._switch.GetGUID()) {
  13.          new CodexSound("locked_large_02.WAV", 300.0F, 600.0F, 100, 0, 0, clickerGuid);
  14.          CodexConsole.PrintNLS(clickerGuid, 0, "GEN_OPENELSEWHERE");
  15.       } else {
  16.          this.bActive = true;
  17.          if (!this.bOpen) {
  18.             this._door1.RotatePivot(this._frameNum, this._duration);
  19.             this._door2.RotatePivot(this._frameNum, this._duration);
  20.             this.bOpen = true;
  21.          } else {
  22.             this._door1.RotatePivot(this._frameNum, -this._duration);
  23.             this._door2.RotatePivot(this._frameNum, -this._duration);
  24.             this.bOpen = false;
  25.          }
  26.  
  27.       }
  28.    }
  29.  
  30.    public void beginscene(int clientGuid, int captureID) {
  31.       this._door1.SetThingFlags(8192);
  32.       this._door2.SetThingFlags(8192);
  33.    }
  34.  
  35.    public void arrived(int thingGuid, int frameNum, int captureId) {
  36.       this.bActive = false;
  37.    }
  38.  
  39.    public SwitchDoubleDoor(float duration, CodexThing door1, CodexThing door2) {
  40.       this._duration = duration;
  41.       this._door1 = new CodexThing(((Codex)door1).GetGUID());
  42.       this._door2 = new CodexThing(((Codex)door2).GetGUID());
  43.       if (this._door1.GetDescriptionID().equalsIgnoreCase("PROP")) {
  44.          this._door1.SetDescriptionID("GEN_DOOR");
  45.       }
  46.  
  47.       if (this._door2.GetDescriptionID().equalsIgnoreCase("PROP")) {
  48.          this._door2.SetDescriptionID("GEN_DOOR");
  49.       }
  50.  
  51.       if (this._switch.GetDescriptionID().equalsIgnoreCase("PROP")) {
  52.          this._switch.SetDescriptionID("GEN_SWITCH");
  53.       }
  54.  
  55.       ((Codex)this).CaptureThing(this._door1.GetGUID());
  56.       ((Codex)this).CaptureThing(this._door2.GetGUID());
  57.    }
  58.  
  59.    public void restore(int flags) {
  60.       this.bOpen = CodexSequence.RestoreBoolean();
  61.    }
  62.  
  63.    public void save(int flags) {
  64.       CodexSequence.SaveBoolean(this.bOpen);
  65.    }
  66. }
  67.