Пример #1
0
        /// <summary>
        /// Метод запускается когда монстр прошёл до точки назначения
        /// </summary>
        public void Pass()
        {
            Killed = true;    // убираем его с поля
            Game.OnMonsterPass(this);

            TextGameAnimation decreaseLifeAnimation = new TextGameAnimation( "-1", Position, Colors.Red, 3.0, 20);
            Game.Field.AddAnimation(decreaseLifeAnimation);
        }
Пример #2
0
        /// <summary>
        /// Действия на попадание ракеты
        /// </summary>
        /// <param name="bullet"></param>
        public virtual void Hit(Bullet bullet)
        {
            TryFreeze(bullet);

            Life -= CalculateDamage( bullet );

            if (Life <= 0)
            {
                Killed = true;
                Game.OnMonsterDied(this);

                TextGameAnimation increaseMoneyAnimation = new TextGameAnimation(Cost.ToString("+#"), Position, Colors.Gold, 3.0, 18);
                Game.Field.AddAnimation(increaseMoneyAnimation);

                DisappearanceImageGameAnimation deathAnimation = new DisappearanceImageGameAnimation(new Uri("/images/skull.png", UriKind.Relative), Position, 10.0);
                Game.Field.AddAnimation(deathAnimation);
            }
        }