Пример #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();
 }