private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            getInstance = this;

            rand = new Random();

            mainCanvas = MainCanvas;

            #region background
            background = new Image();
            background.Source = null;
            background.Width = 960;
            background.Height = 540;
            background.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            background.VerticalAlignment = System.Windows.VerticalAlignment.Top;
            background.Margin = new Thickness(0, 0, 0, 0);
            //mainCanvas.Children.Add(background);

            stateSetInit();

            titleTex = new BitmapImage(new Uri("/MuscleShooting;component/Resource/Back/ArrowSimulaterTitle.png", System.UriKind.Relative));

            tutorialTex = new BitmapImage[4];
            for (int i = 0; i < 4; i++) {
                tutorialTex[i] = new BitmapImage(new Uri("/MuscleShooting;component/Resource/Back/ArrowSimulaterTutorial0" + i.ToString() + ".png", System.UriKind.Relative));
            }
            BackgroundTex =  new BitmapImage(new Uri("/MuscleShooting;component/Resource/Back/ArrowSimulaterBackground01.png", System.UriKind.Relative));
            ResultBackTex = new BitmapImage(new Uri("/MuscleShooting;component/Resource/Back/ArrowSimulaterBackground00.png", System.UriKind.Relative));
            resultTex = new BitmapImage(new Uri("/MuscleShooting;component/Resource/Score/ArrowSimulaterResult.png", System.UriKind.Relative));
            rankingTex = new BitmapImage(new Uri("/MuscleShooting;component/Resource/Score/ArrowSimulaterRanking.png", System.UriKind.Relative));
            SoremadeTex = new BitmapImage(new Uri("/MuscleShooting;component/Resource/Back/soremade.png", System.UriKind.Relative));
            #endregion

            KinectManager kinectManager = new KinectManager();
            kinectManager.Initialize();

            Bow bow = new Bow();
            bow.Initialize();

            SpriteManager spriteManager = new SpriteManager();
            spriteManager.Initialize();

            ShootLine shootLine = new ShootLine();
            shootLine.Initialize();

            new EffectManager().Initilize();

            dispatcherTimer = new DispatcherTimer();

            dispatcherTimer.Interval = new TimeSpan(166666L);

            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);

            dispatcherTimer.Start();

            player = new Player();

            enemy = new EnemyBase[EMax];
            for (int i = 0; i < EMax; i++) enemy[i] = new EnemyBase();

            playersShoot = new ObjectBase[SMax];
            for (int i = 0; i < SMax; i++) playersShoot[i] = new ShootNormal();
            Player.getInstance.shoot = playersShoot;
            //shoot = new Shoot();

            ScoreManager scoreManager = new ScoreManager();
            scoreManager.Initialize();

            //int[] sL = { 100, 300, 500, 1000, 2000, 4000, 8000 };
            //ScoreManager.getInstance.scoreRoot.Add(sL);
            #if false
            TMax = 40;
            target = new TargetBase[TMax];

            for (int i = 0; i < TMax - 15; i++) {
                target[i] = new TargetSimple();
                //target[i].setPosition((float)rand.NextDouble() * 250 + 50, (float)rand.NextDouble() * 400 + 100);
            }
            for (int i = TMax - 15; i < TMax - 3; i++) {
                target[i] = new TargetSmall();
            }
            for (int i = TMax - 3; i < TMax; i++) {
                target[i] = new TargetFire();
            }
            target[0].setPosition(100, 400);

            targetIndex = 0;

            //imageSet.Source = SpriteManager.images[0];
            #endif
        }
Exemplo n.º 2
0
        public void Initialize()
        {
            getInstance = this;

            toPoint = new Point(400, 400);
            fromPoint = new Point(400 + segmentRoot.X, 400);

            rot_mat = new Point(1, 0);

            Length = segmentRoot.X;

            #region パス1
            PathFigure PF = new PathFigure();
            PF.StartPoint = toPoint;
            PF.Segments.Add(new BezierSegment(new Point(toPoint.X + segment1.X, toPoint.Y - segment1.Y), new Point(toPoint.X + segment2.X, toPoint.Y - segment2.Y), new Point(toPoint.X + segmentRoot.X, toPoint.Y - segmentRoot.Y), true));

            PathGeometry PG = new PathGeometry();
            PG.Figures.Add(PF);

            upPath = new Path();
            upPath.Stroke = BowColor;
            upPath.StrokeThickness = 4;
            upPath.Data = PG;
            #endregion
            #region パス2
            PF = new PathFigure();
            PF.StartPoint = toPoint;
            PF.Segments.Add(new BezierSegment(new Point(toPoint.X + segment1.X, toPoint.Y + segment1.Y), new Point(toPoint.X + segment2.X, toPoint.Y + segment2.Y), new Point(toPoint.X + segmentRoot.X, toPoint.Y + segmentRoot.Y), true));

            PG = new PathGeometry();
            PG.Figures.Add(PF);

            downPath = new Path();
            downPath.Stroke = BowColor;
            downPath.StrokeThickness = 4;
            downPath.Data = PG;
            #endregion

            upSting = new Line();
            upSting.Stroke = StingColor;
            upSting.StrokeThickness = 1;
            upSting.X1 = toPoint.X + segmentRoot.X;
            upSting.Y1 = toPoint.Y - segmentRoot.Y;
            upSting.X2 = fromPoint.X;
            upSting.Y2 = fromPoint.Y;

            downSting = new Line();
            downSting.Stroke = StingColor;
            downSting.StrokeThickness = 1;
            downSting.X1 = toPoint.X + segmentRoot.X;
            downSting.Y1 = toPoint.Y + segmentRoot.Y;
            downSting.X2 = fromPoint.X;
            downSting.Y2 = fromPoint.Y;

            Arrow = new Line();
            Arrow.Stroke = IdleColor;
            Arrow.StrokeThickness = 2;

            MainWindow.getInstance.MainCanvas.Children.Add(upSting);
            MainWindow.getInstance.MainCanvas.Children.Add(downSting);
            MainWindow.getInstance.MainCanvas.Children.Add(upPath);
            MainWindow.getInstance.MainCanvas.Children.Add(downPath);
            MainWindow.getInstance.MainCanvas.Children.Add(Arrow);

            //Drawing(new Point(0, 40), new Point(0, 41));
            unDraw();
        }