예제 #1
0
파일: TTarget.cs 프로젝트: rwsh/StarWars
        public TTargets(int N)
        {
            Targets = new TTarget[N];

            for (int n = 0; n < N; n++)
            {
                Targets[n] = new TTarget(n);
            }
        }
예제 #2
0
        public void Draw()
        {
            Line l = new Line();

            l.X1 = W2;
            l.Y1 = H2 - H / 10;
            l.X2 = W2;
            l.Y2 = H2 + H / 10;
            l.StrokeThickness = 1;
            l.Stroke          = Brushes.White;
            g.Children.Add(l);

            l = new Line();

            l.X1 = W2 - W / 10;
            l.Y1 = H2;
            l.X2 = W2 + W / 10;
            l.Y2 = H2;
            l.StrokeThickness = 1;
            l.Stroke          = Brushes.White;
            g.Children.Add(l);

            g.Children.Add(TCircle.O(W2, H2, W / 10, Brushes.White));

            TextXY = new TextBlock();

            TextXY.Text = "X = 0 Y = 0";

            TextXY.Foreground = Brushes.White;

            Canvas.SetLeft(TextXY, W * (3.0 / 4.0));

            Canvas.SetTop(TextXY, H - 20);

            g.Children.Add(TextXY);

            for (int i = 0; i < Stars.Count; i++)
            {
                g.Children.Add(Stars[i].O);
            }

            for (int i = 0; i < Targets.Count; i++)
            {
                Targets[i].Add(g);
            }

            //

            int Name = -1;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    Name++;

                    TTarget T = Targets2[Name];
                    T.H /= 2.0;
                    T.W /= 2.0;
                    T.R /= 2.0;

                    T.xs = T.W + T.W * 4 * j;
                    T.ys = T.H + T.H * 4 * i;

                    T.Draw(Brushes.Red);
                    T.Visibility = Visibility.Visible;

                    T.Add(g2);
                }
            }
        }