예제 #1
0
        public HDHifi(Point3D center, Size3D size, Brush blockTexture, Brush speakerTexture, BitmapImage speakerBlockTexture)
        {
            block         = new ModelVisual3D();
            block.Content = HDModelHelpers.CubeModel(center, size, blockTexture);

            center.Offset(-size.X * 1.5, 0, 0);
            leftSpeaker = new HDSpeaker(center, size, speakerTexture, speakerBlockTexture);

            center.Offset(3 * size.X, 0, 0);
            rightSpeaker = new HDSpeaker(center, size, speakerTexture, speakerBlockTexture);

            mPlayer = new MediaPlayer();
            this.Children.Add(block);
            this.Children.Add(leftSpeaker);
            this.Children.Add(rightSpeaker);
        }
예제 #2
0
        public HDSpeaker(Point3D center, Size3D size, Brush speakerTexture, BitmapImage blockTexture)
        {
            this.size       = size;
            block           = new ModelVisual3D();
            speaker         = new ModelVisual3D();
            block.Content   = HDModelHelpers.CubeModel(center, size, new BitmapImage(new Uri("Hubert_Drogosz/Resources/drewno.png", UriKind.Relative)));
            speaker.Content = HDModelHelpers.MemModel(new Point3D(center.X, center.Y + size.Y / 4, center.Z + size.Z / 2)
                                                      , new Size3D(size.X / 2, size.Y / 4, size.Z / 4)
                                                      , new SolidColorBrush(Colors.DarkGray));

            speaker.Transform = new TranslateTransform3D();
            dTimer            = new DispatcherTimer();
            dTimer.Interval   = new TimeSpan(0, 0, 0, 0, 100);
            dTimer.Tick      += dTimer_Tick;
            dTimer.Start();

            this.Children.Add(speaker);
            this.Children.Add(block);
        }