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