public void IncrementScoreMethodTest_PacmanWonEventRaised() { GameState s = getState(); ScoreAndLives score = s.Score; Maze m = s.Maze; for (int i = 0; i < m.Size; i++) { for (int j = 0; j < m.Size; j++) { if (m[j, i] is PacmanLibrary.Structure.Path) { m[j, i].Member = null; } } } bool expected = true; bool actual = false; m.PacmanWonEvent += () => { actual = true; }; score.IncrementScore(new Energizer()); Assert.AreEqual(expected, actual); }
public void ScorePropertyTestSet_InvalidInput() { GameState s = getState(); ScoreAndLives score = s.Score; score.Score = -100; }
/// <summary> /// The constructor will take as input a game1 object and will /// initialize the data members such as the game1 object, the gamestate /// the scoreandlives object and the isWon to false /// </summary> /// <param name="game">A game1 object</param> public ScoreSprite(Game1 game) : base(game) { this.game = game; this.gs = game.GameState; this.scores = gs.Score; isWon = false; }
public void IncrementScoreMethodTest_InvalidInput() { GameState s = getState(); ScoreAndLives score = s.Score; score.IncrementScore(null); }
public void ScorePropertyTestGet() { GameState s = getState(); ScoreAndLives score = s.Score; int expected = 0; int actual = score.Score; Assert.AreEqual(expected, actual); }
public void LivesPropertyTestSet_ValidInput() { GameState s = getState(); ScoreAndLives score = s.Score; score.Lives = 2; int expected = 2; int actual = score.Lives; Assert.AreEqual(expected, actual); }
public void IncrementScoreMethodTest_CheckScore() { GameState s = getState(); ScoreAndLives score = s.Score; score.IncrementScore(new Pellet()); int expected = 10; int actual = score.Score; Assert.AreEqual(expected, actual); }
public void DeadPacmanMethodTest_EventRaised() { GameState s = getState(); ScoreAndLives score = s.Score; score.Lives = 1; bool expected = true; bool actual = false; score.GameOver += () => { actual = true; }; score.DeadPacman(); Assert.AreEqual(expected, actual); }
public void IncrementScoreMethodTest_WithEnergizer() { GameState s = getState(); ScoreAndLives score = s.Score; score.IncrementScore(new Energizer()); Ghost g = null; foreach (var item in s.GhostPack) { g = item; } GhostState expected = GhostState.Scared; GhostState actual = g.CurrentState; Assert.AreEqual(expected, actual); }
/// <summary> /// Loads the content of the game /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); sl = game.PacManGame.Score; eatenGhost = new List <Ghost>(); font = game.Content.Load <SpriteFont>("score"); lives = game.Content.Load <Texture2D>("livesimage"); score = game.Content.Load <Texture2D>("scoretitle"); //game state gameOver = game.Content.Load <Texture2D>("gameover"); victory = game.Content.Load <Texture2D>("victory"); livesTitle = game.Content.Load <Texture2D>("lives"); //sounds death = game.Content.Load <SoundEffect>("pacmandeath"); beginning = game.Content.Load <SoundEffect>("pacmanbeginning"); beginning.Play(); base.LoadContent(); }
public void ConstructorTest_InvalidInput() { ScoreAndLives s = new ScoreAndLives(null); }
// Use this for initialization void Start() { cam = GameObject.FindGameObjectWithTag("MainCamera"); rb = GetComponent <Rigidbody2D> (); livesObj = GameObject.FindGameObjectWithTag("Score&Lives").GetComponent <ScoreAndLives>(); }
/// <summary> /// Initilizes the field ScoreAndLives and /// calls the initialize method of the base class /// </summary> public override void Initialize() { scores = game.GameState.Score; base.Initialize(); }
// Use this for initialization void Start() { currentHealth = startingHealth; scoreObj = GameObject.FindGameObjectWithTag("Score&Lives"); scoreAndLives = scoreObj.GetComponent <ScoreAndLives> (); }