Example #1
0
 public override void apply(Cat cat)
 {
     if (directionChanger) cat.getDirection().changeDirection();
     cat.getDirection().changePath();
     directionChanger = !directionChanger;
     //Console.WriteLine("Hit Mirror");
 }
Example #2
0
 public void move(Cat cat)
 {
     Position pos = cat.getPosition();
     pos.x += dir[0];
     pos.y += dir[1];
     cat.setPosition(pos);
 }
Example #3
0
 public override void apply(Cat cat)
 {
     Direction catDir = cat.getDirection();
     cat.changeDirection(this.dir);
     this.dir = catDir;
     dir.changeDirection();
     //Console.WriteLine("Hit Arrow");
 }
Example #4
0
 public virtual void apply(Cat cat)
 {
 }
Example #5
0
 public override void apply(Cat cat)
 {
     cat.changeScore(scoreChange);
     //Console.WriteLine("Score modified by: " + SCORE_CHANGE.ToString());
 }
Example #6
0
 private static void runGame(CellObject[][] board)
 {
     Cat cat = new Cat();
     while (true) {
         cat.move();
         if (!inBounds(cat, board)) break;
         Position p = cat.getPosition();
         board[p.y][p.x].apply(cat);
     }
     Console.ReadLine();
 }
Example #7
0
 private static bool inBounds(Cat cat, CellObject[][] board)
 {
     Position p = cat.getPosition();
     if (p.y < 0 || p.y > board.Length-1 || p.x < 0 || p.x > board[0].Length-1) return false;
     return true;
 }
Example #8
0
 public override void apply(Cat cat)
 {
     cat.printScore();
 }