示例#1
0
        List<Target> winners; // subset of targets

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructs new bonus screen
        /// </summary>
        /// <param name="theData"></param>
        public BonusScreen(GameData theData)
        {
            data = theData;
            player = new BonusPlayer(theData);
            numberOfTargets = 12;
            targets = new List<Target>();
            winners = new List<Target>();
            player = new BonusPlayer(data);
            currentTarget = null;
        }
示例#2
0
 /// <summary>
 /// Checks to see if the player has collided with the given target.
 /// </summary>
 /// <param name="target"></param>
 /// <returns></returns>
 public bool CheckPlayersCollision(Target target)
 {
     Rectangle overlap = Rectangle.Intersect(Bound, target.GetBound());
     return !overlap.IsEmpty;
 }
示例#3
0
        /// <summary>
        /// Handle mouse event driven aspects of the bonus area
        /// </summary>
        /// <param name="gameTime"></param>
        private void ProcessMouse(GameTime gameTime)
        {
            MouseState mouseState = Mouse.GetState();

            for (int i = 0; i < numberOfTargets; i++)
            {
                if (targets[i].validLeftClick(mouseState))
                {
                    targets[i].Animate(gameTime);

                    if (targets[i].isCorrect() && !targets[i].hasBeenChosen())
                    {
                        player.GoTo(mouseState.X, mouseState.Y);
                        currentTarget = targets[i];
                    }
                }
                if (targets[i].Equals(currentTarget) &&
                    //player.reachedDestination(currentTarget.getPosition()))
                    player.CheckPlayersCollision(targets[i]))
                {
                    data.currentPlayer.life.increaseMax(targets[i].select());
                }
            }
        }