示例#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;
                    }
                }
            }
        }
示例#2
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);
            }
        }
示例#3
0
 public bool IsBallDestroyer(IBall ball)
 {
     return(tailManager.Find(ball) != null);
 }
示例#4
0
 public void Detect(IBall ball)
 {
     DetectBrickCollision(ball, tailManager?.Find(ball) != null);
 }