コード例 #1
0
        /// <summary>
        /// When an enemy is killed, delete it and replace it with its corpse.
        /// This saves processing it for collisions etc.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnEnemyKilled(object sender, EnemyKilledEventArgs e)
        {
            Enemy enemy = e.enemy;

            killList.Add(enemy);

            Decal corpse = enemy.CorpseAppearance;

            corpse        = corpse.Clone() as Decal;//New instance of the corpse decal
            corpse.Effect = enemy.DirectionalEffect;
            var offset = enemy.Appearance.Size - corpse.Size;

            corpse.SetPosition(enemy.Position + offset);

            corpses.Add(corpse);
        }