Advertisement
Guest User

Untitled

a guest
Jul 4th, 2013
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1. package Walker;
  2.  
  3. import org.osbot.script.Script;
  4.  
  5. public class Path {
  6.  
  7.     public PathTile[] tiles;
  8.     private Script s;
  9.  
  10.     public int index;
  11.     public int maxIndex;
  12.     private boolean walking;
  13.     private int random;
  14.  
  15.     public Path(Script scr, PathTile[] t, int r) {
  16.     this.s = scr;
  17.     this.tiles = t;
  18.  
  19.     this.index = 0;
  20.     this.maxIndex = (t.length - 1);
  21.     this.walking = false;
  22.     this.random = r;
  23.     }
  24.  
  25.     public void start() {
  26.     this.randomize();
  27.     this.walking = true;
  28.     }
  29.  
  30.     public void reset() {
  31.     this.index = 0;
  32.     this.walking = false;
  33.     }
  34.  
  35.     public void stop() throws InterruptedException {
  36.     this.reset();
  37.     this.s.setRunning(false);
  38.     }
  39.    
  40.     public void asd() {
  41.    
  42.     }
  43.  
  44.     public boolean shouldStop() {
  45.     if (this.index > this.maxIndex) {
  46.         return true;
  47.     }
  48.     return false;
  49.     }
  50.  
  51.     public boolean isWalking() {
  52.     return this.walking;
  53.     }
  54.  
  55.     public PathTile next() {
  56.     PathTile rtn = this.tiles[this.index];
  57.     this.index += 1;
  58.     return rtn;
  59.     }
  60.  
  61.     public boolean shouldNext() {
  62.     PathTile x = this.testNext();
  63.     if (x != null && this.s.canReach(x) && x.random) {
  64.         return true;
  65.     }
  66.     return false;
  67.     }
  68.  
  69.     private PathTile testNext() {
  70.     if (!this.shouldStop()) {
  71.         return this.tiles[this.index];
  72.     } else {
  73.         return null;
  74.     }
  75.     }
  76.  
  77.     public void randomize() {
  78.     for (int x = 0; x < this.tiles.length; x++) {
  79.         this.tiles[x] = this.tiles[x].randomize(this.s, this.random);
  80.     }
  81.     }
  82.  
  83.     public boolean isWalkable() {
  84.     boolean isit = true;
  85.     for (int x = 0; x < this.tiles.length; x++) {
  86.         if (x != 0) {
  87.  
  88.         }
  89.     }
  90.     return isit;
  91.     }
  92.  
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement