Exemplo n.º 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(Gem gem, Player collectedBy)
        {
            score += Gem.PointValue;

            gem.OnCollected(collectedBy);
        }
Exemplo n.º 2
0
 private void OnEnemyKilled(Enemy enemy, Player killedBy)
 {
     enemy.OnKilled(killedBy);
 }
Exemplo n.º 3
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();
 }
Exemplo n.º 4
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, TileMovement.Static);
        }
Exemplo n.º 5
0
 public void OnKilled(Player killedBy)
 {
     IsAlive = false;
     killedSound.Play();
 }