Example #1
0
 private void addFrogToFrogHome(FrogHome frogHome)
 {
     SoundEffects.PlayHomeLandingSound();
     frogHome.AddFrog();
     this.gameCanvas.Children.Add(frogHome.Sprite);
     this.playerScores();
 }
Example #2
0
 private void addFrogHomesToManager(int numberOfHomes)
 {
     for (var i = 0; i < numberOfHomes; i++)
     {
         var home = new FrogHome();
         this.frogHomeManager.AddFrogHome(home);
         this.gameCanvas.Children.Add(home.Sprite);
     }
 }
Example #3
0
 private void handleFrogHomeOccupation(FrogHome home)
 {
     if (!home.IsFrogHomeOccupied())
     {
         home.MarkFrogHomeOccupied();
         this.playerManager.IncrementHousesOccupied();
     }
     else
     {
         this.handlePlayerLosingLife();
     }
 }
Example #4
0
        /// <summary>
        ///     Checks for player on frog home collision.
        ///     Precondition: player != null AND home != null
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="home">The home.</param>
        /// <returns>
        ///     True if player is intersecting a home's bounding box, false otherwise
        /// </returns>
        /// <exception cref="ArgumentNullException">
        ///     player
        ///     or
        ///     home
        /// </exception>
        public bool CheckForPlayerOnFrogHomeCollision(Frog player, FrogHome home)
        {
            if (player == null)
            {
                throw new ArgumentNullException(nameof(player));
            }

            if (home == null)
            {
                throw new ArgumentNullException(nameof(home));
            }

            return(player.BoundingBox.IntersectsWith(home.BoundingBox));
        }
Example #5
0
 private void handleFrogMadeItHome(FrogHome frogHome)
 {
     if (frogHome.Sprite.Visibility == Visibility.Visible)
     {
         this.handleLifeLost();
     }
     else
     {
         this.playerOnMovingLog = false;
         this.handlePlayerScored();
         frogHome.Sprite.Visibility = Visibility.Visible;
         this.playerManager.IncrementFrogsInHomes();
         this.checkForGameOver();
         this.checkForLevelOver();
         this.playerIsImmune = false;
     }
 }