Example #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);
        }
Example #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();
 }
Example #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 = GetBounds(x, y).GetBottomCenter();
            Player = new Player(this, start);
            Game.Penumbra.Lights.Add(Player.Light);
            Game.Interpreter.RemoveVariable("player");
            Game.Interpreter.AddVariable("player", Player);

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