Exemple #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());
 }
Exemple #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());
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #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());
        }
Exemple #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;
        }