Example #1
0
 private void createLifeIndicator()
 {
     lifeIndicator         = new Rectangle();
     lifeIndicator.Height  = 0.25 * Radius.ToPixels();
     lifeIndicator.Fill    = new SolidColorBrush(Colors.Green);
     lifeIndicator.RadiusX = lifeIndicator.RadiusY = 1.0;
     Panel.SetZIndex(lifeIndicator, Game.Field.GetLastMonsterZIndex());
 }
Example #2
0
        public override void Tick(double interval)
        {
            base.Tick(interval);

            lifeIndicator.Width = (Kernel.Life / Kernel.StartLife) * 2 * Radius.ToPixels();

            Canvas.SetLeft(lifeIndicator, Position.X - Radius.ToPixels());
            Canvas.SetTop(lifeIndicator, Position.Y + Radius.ToPixels());
        }
Example #3
0
        public override void Tick(double interval)
        {
            base.Tick(interval);

            reloadingIndicator.Width = (Kernel.TimeToReloading * Kernel.ReloadingSpeed) * 2 * Radius.ToPixels();

            Canvas.SetLeft(reloadingIndicator, Position.X - Radius.ToPixels());
            Canvas.SetTop(reloadingIndicator, Position.Y + Radius.ToPixels() - reloadingIndicator.Height);
        }
Example #4
0
        /// <summary>
        /// Функция возвращающая истину, если монстр находится в области атаки
        /// </summary>
        public override bool InAttackArea(Monster monster)
        {
            if (HelperFunctions.GetLength(Position, monster.Position) <= AttackRadius.ToPixels())
            {
                if (Math.Abs(monster.Position.X - Position.X) <= Radius.ToPixels() || Math.Abs(monster.Position.Y - Position.Y) <= Radius.ToPixels())
                {
                    return(true);
                }
            }

            return(false);
        }
Example #5
0
        private void createLevel()
        {
            level = new Label();
            level.IsHitTestVisible           = false;
            level.FontFamily                 = new FontFamily("Calibri");
            level.FontSize                   = 10.0;
            level.Width                      = level.Height = 2 * Radius.ToPixels();
            level.VerticalContentAlignment   = VerticalAlignment.Center;
            level.HorizontalContentAlignment = HorizontalAlignment.Center;

            TextOptions.SetTextFormattingMode(level, TextFormattingMode.Display);
            Panel.SetZIndex(level, GameProperties.TowersLevelZIndex);
            Canvas.SetLeft(level, Position.X - Radius.ToPixels());
            Canvas.SetTop(level, Position.Y - Radius.ToPixels());
        }
Example #6
0
        private void recreateDrawAttackGeometry(Path attackArea)
        {
            RectangleGeometry hRect = new RectangleGeometry();

            hRect.Rect    = new Rect(0.0, AttackRadius.ToPixels() - Radius.ToPixels(), 2 * AttackRadius.ToPixels(), 2 * Radius.ToPixels());
            hRect.RadiusX = hRect.RadiusY = 5;

            RectangleGeometry vRect = new RectangleGeometry();

            vRect.Rect    = new Rect(AttackRadius.ToPixels() - Radius.ToPixels(), 0.0, 2 * Radius.ToPixels(), 2 * AttackRadius.ToPixels());
            vRect.RadiusX = vRect.RadiusY = 5;

            Geometry crossGeometry = new CombinedGeometry(GeometryCombineMode.Union, hRect, vRect);

            attackArea.Data = crossGeometry;
        }