예제 #1
0
 public override void apply(Cat cat)
 {
     if (directionChanger) cat.getDirection().changeDirection();
     cat.getDirection().changePath();
     directionChanger = !directionChanger;
     //Console.WriteLine("Hit Mirror");
 }
예제 #2
0
 public void move(Cat cat)
 {
     Position pos = cat.getPosition();
     pos.x += dir[0];
     pos.y += dir[1];
     cat.setPosition(pos);
 }
예제 #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");
 }
예제 #4
0
 public virtual void apply(Cat cat)
 {
 }
예제 #5
0
 public override void apply(Cat cat)
 {
     cat.changeScore(scoreChange);
     //Console.WriteLine("Score modified by: " + SCORE_CHANGE.ToString());
 }
예제 #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();
 }
예제 #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;
 }
예제 #8
0
 public override void apply(Cat cat)
 {
     cat.printScore();
 }