private void mapBox_Paint(object sender, PaintEventArgs e) { g = e.Graphics; if (mouse == null) { mouse = new MouseController(g, cellSize, myMap, this, cat); } else { mouse.DrawMouse(g); } if (cat == null) { cat = new CatController(g, cellSize, myMap, this, mouse); } else { cat.DrawCat(g); } // draw the paving slabs foreach (Cell myCell in myMap) { myCell.drawBackground(g); } mouse.Cat = cat; su = new ScoreInfoEventArgs(); mouse.ScoreChange += new ScoreChangeEventHandler(ChangeScore); gameRunning = true; }
public void TestMethod2() { //Arrange CatController cat = new CatController(); cat.Paused = true; //Act cat.UnPause(); //Assert Assert.IsTrue(cat.Paused == false); }
public MouseController(Graphics g, int cellSize, Cell[,] map, GameBoard f, CatController cat) { CurPos.pixX += (cellSize / 4 + 1); CurPos.pixY += (cellSize / 4 + 1); this.moveDistance = this.cellSize = cellSize; this.g = g; this.map = map; this.cat = cat; this.f = f; Collisions += new CollisionCheck(CheckCollision); LoadMouseImage(); DrawMouse(g); simpleSound = new SoundPlayer(@"..\\..\\res\\cat.wav"); }