Example #1
0
        private void DrawTail(IBall ball)
        {
            ITail tail = tailManager.Find(ball);

            if (tail != null)
            {
                int i       = 0;
                int opacity = 150;

                ball.GetSize(out int width, out int height);

                foreach (Vector2 position in tail)
                {
                    ++i;
                    if (i % 14 == 0)
                    {
                        if (opacity < 0)
                        {
                            break;
                        }

                        Color color = Color.Cyan;
                        color.A = (byte)opacity;

                        CircleShape circle = new CircleShape();
                        circle.Position  = new Vector2f(position.X, position.Y);
                        circle.Radius    = (float)width / 2;
                        circle.FillColor = color;
                        render.Draw(circle);

                        opacity = opacity - 60;
                    }
                }
            }
        }
Example #2
0
 public void Add(IBall ball, ITail tail)
 {
     if (!tails.ContainsKey(ball))
     {
         tails.Add(ball, tail);
     }
 }
Example #3
0
        private void DrawTail(Graphics g, IBall ball)
        {
            ITail tail = Game.TailManager.Find(ball);

            if (tail != null)
            {
                int i       = 0;
                int opacity = 150;
                foreach (Position position in tail)
                {
                    ++i;
                    if (i % 12 == 0)
                    {
                        if (opacity < 0)
                        {
                            opacity = 0;
                        }

                        ball.GetSize(out var width, out var height);

                        SolidBrush tailBrush = new SolidBrush(Color.FromArgb(opacity, Color.LightCoral));
                        g.FillEllipse(
                            tailBrush,
                            new Rectangle(position.X, position.Y, width, height));
                        tailBrush.Dispose();

                        opacity = opacity - 40;
                    }
                }
            }
        }
Example #4
0
        protected override void OnViewAttached(object view, object context)
        {
            base.OnViewAttached(view, context);

            var tail = view as ITail;

            _tail = tail ?? new TailNull();
        }
Example #5
0
 internal Parser(ITail logTail, IConfiguration configuration)
 {
     tail = logTail;
     rules = new List<IRule>();
     if (configuration != null)
     {
         rules = configuration.Rules;
     }
 }
Example #6
0
 public bool Remove(ITail tail)
 {
     foreach (var pair in tails)
     {
         if (pair.Value == tail)
         {
             return(tails.Remove(pair.Key));
         }
     }
     return(false);
 }
Example #7
0
        private void SavePosition(IBall ball)
        {
            ball.SavePosition();

            ITail tail = tailManager.Find(ball);

            if (tail != null)
            {
                Vector2 position = new Vector2(ball.Boundary.Min.X, ball.Boundary.Min.Y);
                tail.Add(position);
            }
        }
Example #8
0
        public void SavePosition(IBall ball)
        {
            ball.SavePosition();

            IElement element = ball as IElement;

            if (ball != null)
            {
                ITail tail = tailManager.Find(ball);
                if (tail != null)
                {
                    Position position = new Position {
                        X = element.PosX, Y = element.PosY
                    };
                    tail.Add(position);
                }
            }
        }
Example #9
0
        public void FireBallTimerHandler(ITail tail, int value)
        {
            if (value <= 0)
            {
                if (tailManager.Remove(tail))
                {
                    counters.Remove(tail);
                }
                return;
            }

            if (!counters.Keys.Contains(tail))
            {
                counters.Add(tail, value);
            }
            else
            {
                counters[tail] = value;
            }
        }
Example #10
0
 public Dog(IHunter hunter, ITail tail)
 {
     _hunter = hunter;
     _tail   = tail;
 }
Example #11
0
 public CatDog(IHunter hunter, ITail tail, IValerian valerian)
 {
     _hunter   = hunter;
     _tail     = tail;
     _valerian = valerian;
 }