示例#1
0
        /// <summary>
        /// Called when a gem is collected.
        /// </summary>
        /// <param name="gem">The gem that was collected.</param>
        /// <param name="collectedBy">The player who collected this gem.</param>
        private void OnGemCollected(Coin coin, Player collectedBy)
        {
            score += Coin.PointValue;

            coin.OnCollected(collectedBy);
        }
示例#2
0
 /// <summary>
 /// Called when this gem has been collected by a player and removed from the level.
 /// </summary>
 /// <param name="collectedBy">
 /// The player who collected this gem. Although currently not used, this parameter would be
 /// useful for creating special powerup gems. For example, a gem could make the player invincible.
 /// </param>
 public void OnCollected(Player collectedBy)
 {
     collectedSound.Play();
 }
示例#3
0
        /// <summary>
        /// Instantiates a player, puts him in the level, and remembers where to put him when he is resurrected.
        /// </summary>
        private Tile LoadStartTile(int x, int y)
        {
            if (Player != null)
                throw new NotSupportedException("A level may only have one starting point.");

            start = RectangleExtensions.GetBottomCenter(GetBounds(x, y));
            player = new Player(this, start);

            return new Tile(null, TileCollision.Passable);
        }