home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1996 June / PCPRO_696.ISO / plugins / wirl3d / data.1 / VRCAsyncRobot.class (.txt) < prev    next >
Encoding:
Java Class File  |  1995-03-11  |  1.4 KB  |  89 lines

  1. class VRCAsyncRobot extends Thread {
  2.    VRCRobot VRCRobo;
  3.    private boolean kill = false;
  4.    private String sCommand = new String();
  5.    private int repeat = 1;
  6.  
  7.    VRCAsyncRobot(VRCRobot var1) {
  8.       this.VRCRobo = var1;
  9.       ((Thread)this).start();
  10.    }
  11.  
  12.    public void run() {
  13.       while(!this.kill) {
  14.          if (this.sCommand.equals("walk")) {
  15.             System.out.println("Walking");
  16.  
  17.             for(int var7 = 0; var7 < this.repeat; ++var7) {
  18.                this.VRCRobo.walk();
  19.             }
  20.  
  21.             this.sCommand = "";
  22.             this.suicide();
  23.          } else if (this.sCommand.equals("animate")) {
  24.             for(int var6 = 0; var6 < this.repeat; ++var6) {
  25.                this.VRCRobo.animate();
  26.             }
  27.  
  28.             this.sCommand = "";
  29.             this.suicide();
  30.          } else if (this.sCommand.equals("rwave")) {
  31.             for(int var5 = 0; var5 < this.repeat; ++var5) {
  32.                this.VRCRobo.wave("right");
  33.             }
  34.  
  35.             this.sCommand = "";
  36.             this.suicide();
  37.          } else if (this.sCommand.equals("lwave")) {
  38.             for(int var4 = 0; var4 < this.repeat; ++var4) {
  39.                this.VRCRobo.wave("left");
  40.             }
  41.  
  42.             this.sCommand = "";
  43.             this.suicide();
  44.          } else if (this.sCommand.equals("lleg")) {
  45.             for(int var3 = 0; var3 < this.repeat; ++var3) {
  46.                this.VRCRobo.liftLeg("left");
  47.             }
  48.  
  49.             this.sCommand = "";
  50.             this.suicide();
  51.          } else if (this.sCommand.equals("rleg")) {
  52.             for(int var2 = 0; var2 < this.repeat; ++var2) {
  53.                this.VRCRobo.liftLeg("right");
  54.             }
  55.  
  56.             this.sCommand = "";
  57.             this.suicide();
  58.          } else if (this.sCommand.equals("color")) {
  59.             for(int var1 = 0; var1 < this.repeat; ++var1) {
  60.                this.VRCRobo.colorRainbo();
  61.             }
  62.  
  63.             this.sCommand = "";
  64.             this.suicide();
  65.          }
  66.       }
  67.  
  68.    }
  69.  
  70.    public void destroy() {
  71.       this.repeat = 0;
  72.       this.kill = true;
  73.       ((Thread)this).stop();
  74.    }
  75.  
  76.    public void sendCommand(String var1) {
  77.       this.sCommand = var1;
  78.    }
  79.  
  80.    public void suicide() {
  81.       this.kill = true;
  82.       ((Thread)this).stop();
  83.    }
  84.  
  85.    public void repeat(int var1) {
  86.       this.repeat = var1;
  87.    }
  88. }
  89.