Exemple #1
0
        /// <summary>
        /// Common logic for enemy died event
        /// We check if that enemy is our target. If it is, we choose another one
        /// </summary>
        /// <param name="enemyArgs"></param>
        private void EnemyDiedEventHandler(EnemyDiedEvent enemyArgs)
        {
            var enemy = enemyArgs.Enemy;

            // If this dead enemy was in our possible enemies list, we remove it
            if (_targetsInRange.Contains(enemy))
            {
                _targetsInRange.Remove(enemy);
            }

            // If this dead enemy was our target, we choose a new one from the list
            if (_currentTarget == enemy)
            {
                ChangeCurrentTargetTo(ChooseFromTargetsInRange());
            }
        }
Exemple #2
0
 /// <summary>
 /// Enemy died event handler
 /// We change the number of dead enemies for an appropriate appearance
 /// </summary>
 /// <param name="enemyArgs">An enemy that has died</param>
 private void SpawnedEnemyOnDiedEvent(EnemyDiedEvent enemyArgs)
 {
     if (_enemyAppearanceReveseLookup.ContainsKey(enemyArgs.Enemy))
     {
         var appearance = _enemyAppearanceReveseLookup[enemyArgs.Enemy];
         appearance.NumberOfEnemiesDied++;
     }
 }