示例#1
0
        /// <summary>
        /// Called when a HealthPotion is collected.
        /// </summary>
        /// <param name="healthPotion">The healthPotion that was collected.</param>
        /// <param name="collectedBy">The player who collected this healthPotion.</param>
        private void OnHealthPotionCollected(HealthPotion healthPotion, LevelPlayer collectedBy)
        {
            collectedBy.Health += (2 * collectedBy.fullHealth / 3);
            if (collectedBy.Health >= collectedBy.fullHealth)
            {
                collectedBy.Health = collectedBy.fullHealth;
            }

            healthPotion.OnCollected(collectedBy);
        }