Exemple #1
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

            camera2d.BackgroundColor = Color.Black;
            EntityManager.Add(camera2d);

            //Register bank
            SoundBank bank = new SoundBank(Assets);

            WaveServices.SoundPlayer.RegisterSoundBank(bank);

            //Register sounds
            sound1 = new SoundInfo("Content/Menu.wpk");
            bank.Add(sound1);

            sound2 = new SoundInfo("Content/Pistol.wpk");
            bank.Add(sound2);

            sound3 = new SoundInfo("Content/Upgrade.wpk");
            bank.Add(sound3);

            sound4 = new SoundInfo("Content/Sell.wpk");
            bank.Add(sound4);
        }
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            // Create the sound bank
            SoundBank spankerSlamSounds = new SoundBank();
            spankerSlamSounds.Add(SoundsManager.FootStep1);
            spankerSlamSounds.Add(SoundsManager.FootStep2);
            WaveServices.SoundPlayer.RegisterSoundBank(spankerSlamSounds);
        }
Exemple #3
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            // Create the sound bank
            SoundBank spankerSlamSounds = new SoundBank();

            spankerSlamSounds.Add(SoundsManager.FootStep1);
            spankerSlamSounds.Add(SoundsManager.FootStep2);
            WaveServices.SoundPlayer.RegisterSoundBank(spankerSlamSounds);
        }
Exemple #4
0
        /**
         * <summary>
         * Adds a new sound to the bank and returns the assigned id for that song
         * </summary>
         */
        private int AddSoundToBank(SoundBank soundBank, string s)
        {
            var sound = new SoundInfo(s);

            soundBank.Add(sound);
            return(sound.SoundId);
        }
Exemple #5
0
 public Tower_Chandler(int x, int y, int counter, string sprite) : base(x, y, counter, sprite)
 {
     Console.WriteLine("GOT CHANDLER TOWER !");
     sample    = new SoundInfo("Content/Towers/Tower_Chandler/whip_chandler.wpk");
     SoundBank = new SoundBank();
     SoundBank.Add(sample);
     WaveServices.SoundPlayer.RegisterSoundBank(SoundBank);
 }
Exemple #6
0
        private void InitializeSoundbank()
        {
            SoundBank soundBank = new SoundBank(Assets);

            WaveServices.SoundPlayer.RegisterSoundBank(soundBank);

            soundBank.Add(WaveServices.GetService <SoundService>().Sound["buttonClick"]);
        }
Exemple #7
0
 private void AddSoundEffect(string fileDirectory, string key = null)
 {
     if (key == null)
     {
         SoundBank.Add(fileDirectory, _content.Load <SoundEffect>(fileDirectory));
     }
     else
     {
         SoundBank.Add(key, _content.Load <SoundEffect>(fileDirectory));
     }
 }
Exemple #8
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Black;

            //Register bank
            SoundBank bank = new SoundBank(Assets);
            WaveServices.SoundPlayer.RegisterSoundBank(bank);

            //Register sounds
            sound1 = new SoundInfo("Content/Menu.wpk");
            bank.Add(sound1);

            sound2 = new SoundInfo("Content/Pistol.wpk");
            bank.Add(sound2);

            sound3 = new SoundInfo("Content/Upgrade.wpk");
            bank.Add(sound3);

            sound4 = new SoundInfo("Content/Sell.wpk");
            bank.Add(sound4);
        }
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            //Register bank
            SoundBank bank = new SoundBank(Assets);
            WaveServices.SoundPlayer.RegisterSoundBank(bank);

            //Register sounds
            MenuSound = new SoundInfo(WaveContent.Assets.Menu_wav);
            bank.Add(MenuSound);

            pistolSound = new SoundInfo(WaveContent.Assets.Pistol_wav);
            bank.Add(pistolSound);

            upgradeSound = new SoundInfo(WaveContent.Assets.Upgrade_wav);
            bank.Add(upgradeSound);

            sellSound = new SoundInfo(WaveContent.Assets.Sell_wav);
            bank.Add(sellSound);
        }
Exemple #10
0
        protected override void CreateScene()
        {
            #region Scene creation
            // Create the camera
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(2, 1, 2), new Vector3(0, 1, 0));
            EntityManager.Add(camera.Entity);

            RenderManager.SetActiveCamera(camera.Entity);

            // Create the model. Note of we add the Animation3D component.
            Entity animatedModel = new Entity("Isis")
                                   .AddComponent(new Transform3D())
                                   .AddComponent(new BoxCollider())
                                   .AddComponent(new SkinnedModel("Content/isis.wpk"))
                                   .AddComponent(new MaterialsMap(new BasicMaterial("Content/isis-difuse.wpk")))
                                   .AddComponent(new Animation3D("Content/isis-animations.wpk"))
                                   .AddComponent(new SkinnedModelRenderer())
                                   .AddComponent(new IsisBehavior());

            // Create the sound bank
            SoundBank spankerSlamSounds = new SoundBank();
            spankerSlamSounds.Add(SoundsManager.FootStep1);
            spankerSlamSounds.Add(SoundsManager.FootStep2);
            WaveServices.SoundPlayer.RegisterSoundBank(spankerSlamSounds);

            RenderManager.BackgroundColor = Color.CornflowerBlue;
            #endregion

            #region Key Events
            // Add the key frames. The first parameter is the name of the animation, the second the number of frames and the third the name of the event. As you can see, we raise two events when
            // the animation is "Attack" ( see the Animation3D example for further information ). The first event is raised on frame 10 and the second on frame 25. See the SpankerBehavior class
            animation = animatedModel.FindComponent <Animation3D>()
                        .AddKeyFrameEvent("Jog", 1, "DoFootstep")
                        .AddKeyFrameEvent("Jog", 14, "DoFootstep")
                        .AddKeyFrameEvent("Jog", 26, "DoFootstep")
                        .AddKeyFrameEvent("Jog", 39, "DoFootstep");
            EntityManager.Add(animatedModel);
            #endregion
        }
Exemple #11
0
        protected override void CreateScene()
        {
            #region Scene creation
            // Create the camera
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(2, 1, 2), new Vector3(0, 1, 0));
            EntityManager.Add(camera.Entity);

            RenderManager.SetActiveCamera(camera.Entity);

            // Create the model. Note of we add the Animation3D component.
            Entity animatedModel = new Entity("Isis")
                .AddComponent(new Transform3D())
                .AddComponent(new BoxCollider())
                .AddComponent(new SkinnedModel("Content/isis.wpk"))
                .AddComponent(new MaterialsMap(new BasicMaterial("Content/isis-difuse.wpk")))
                .AddComponent(new Animation3D("Content/isis-animations.wpk"))
                .AddComponent(new SkinnedModelRenderer())
                .AddComponent(new IsisBehavior());

            // Create the sound bank
            SoundBank spankerSlamSounds = new SoundBank();
            spankerSlamSounds.Add(SoundsManager.FootStep1);
            spankerSlamSounds.Add(SoundsManager.FootStep2);
            WaveServices.SoundPlayer.RegisterSoundBank(spankerSlamSounds);

            RenderManager.BackgroundColor = Color.CornflowerBlue;
            #endregion

            #region Key Events
            // Add the key frames. The first parameter is the name of the animation, the second the number of frames and the third the name of the event. As you can see, we raise two events when
            // the animation is "Attack" ( see the Animation3D example for further information ). The first event is raised on frame 10 and the second on frame 25. See the SpankerBehavior class
            animation = animatedModel.FindComponent<Animation3D>()
                .AddKeyFrameEvent("Jog", 1, "DoFootstep")
                .AddKeyFrameEvent("Jog", 14, "DoFootstep")
                .AddKeyFrameEvent("Jog", 26, "DoFootstep")
                .AddKeyFrameEvent("Jog", 39, "DoFootstep");
            EntityManager.Add(animatedModel);
            #endregion
        }
Exemple #12
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            //Register bank
            SoundBank bank = new SoundBank(Assets);

            WaveServices.SoundPlayer.RegisterSoundBank(bank);

            //Register sounds
            MenuSound = new SoundInfo(WaveContent.Assets.Menu_wav);
            bank.Add(MenuSound);

            pistolSound = new SoundInfo(WaveContent.Assets.Pistol_wav);
            bank.Add(pistolSound);

            upgradeSound = new SoundInfo(WaveContent.Assets.Upgrade_wav);
            bank.Add(upgradeSound);

            sellSound = new SoundInfo(WaveContent.Assets.Sell_wav);
            bank.Add(sellSound);
        }
Exemple #13
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            //Register bank
            SoundBank bank = new SoundBank(Assets);

            WaveServices.SoundPlayer.RegisterSoundBank(bank);

            //Register sounds
            this.menuSound = new SoundInfo(WaveContent.Assets.Menu_wav);
            bank.Add(menuSound);

            this.pistolSound = new SoundInfo(WaveContent.Assets.Pistol_wav);
            bank.Add(pistolSound);

            this.upgradeSound = new SoundInfo(WaveContent.Assets.Upgrade_wav);
            bank.Add(upgradeSound);

            this.sellSound = new SoundInfo(WaveContent.Assets.Sell_wav);
            bank.Add(sellSound);

            StackPanel controlPanel = new StackPanel()
            {
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                Margin      = new WaveEngine.Framework.UI.Thickness(0, 0, 30, 30),
                BorderColor = Color.White,
                IsBorder    = true,
            };

            this.AddButton("Play Menu", this.menuSound, controlPanel);
            this.AddButton("Play Pistol", this.pistolSound, controlPanel);
            this.AddButton("Play Upgrade", this.upgradeSound, controlPanel);
            this.AddButton("Play Sell", this.sellSound, controlPanel);

            EntityManager.Add(controlPanel);
        }
Exemple #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SimpleSoundService" /> class.
        /// </summary>
        protected override void Initialize()
        {
            _gameStorage = Catalog.GetItem <GameStorage>();

            _soundPlayer = WaveServices.SoundPlayer;

            // fill sound info
            _sounds = new Dictionary <SoundType, SoundInfo>();
            _sounds.Add(SoundType.Button, new SoundInfo(WaveContent.Assets.Sounds.Button_wav));
            _sounds.Add(SoundType.Back, new SoundInfo(WaveContent.Assets.Sounds.Clap_wav));
            _sounds.Add(SoundType.Rotating, new SoundInfo(WaveContent.Assets.Sounds.Rotating_wav));
            _sounds.Add(SoundType.Timer, new SoundInfo(WaveContent.Assets.Sounds.Timer_wav));
            _sounds.Add(SoundType.Pick, new SoundInfo(WaveContent.Assets.Sounds.Pick_wav));
            _sounds.Add(SoundType.Win, new SoundInfo(WaveContent.Assets.Sounds.Win_wav));
            _sounds.Add(SoundType.Lose, new SoundInfo(WaveContent.Assets.Sounds.Lose_wav));

            _bank = new SoundBank();
            _soundPlayer.RegisterSoundBank(_bank);

            foreach (var item in _sounds)
            {
                _bank.Add(item.Value);
            }
        }
Exemple #15
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.Black
            };

            EntityManager.Add(camera2D);

            int offsetTop = 50;

            //Create BackGround
            var background = new Entity("Background")
                             .AddComponent(new Sprite("Content/Texture/real-pong.wpk"))
                             .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                             .AddComponent(new Transform2D()
            {
                XScale = 1.5f,
                YScale = 1.45f,
            });

            //Create UI
            textblockGoal1 = new TextBlock("Goal1")
            {
                Margin   = new Thickness((WaveServices.Platform.ScreenWidth / 2f) - 100, offsetTop, 0, 0),
                FontPath = "Content/Font/Calisto MT.wpk",
                Text     = "0",
                Height   = 130,
            };



            textblockGoal2 = new TextBlock("Goal2")
            {
                Margin   = new Thickness((WaveServices.Platform.ScreenWidth / 2f) + 50, offsetTop, 0, 0),
                FontPath = "Content/Font/Calisto MT.wpk",
                Text     = "0",
                Height   = 130,
            };


            textblockInit = new TextBlock("TextInit")
            {
                Margin    = new Thickness((WaveServices.Platform.ScreenWidth / 2f) - 50, offsetTop + 150, 0, 0),
                FontPath  = "Content/Font/Calisto MT.wpk",
                Text      = "",
                Height    = 130,
                IsVisible = false,
            };


            //Create Borders
            var barTop = new Entity("BarTop")
                         .AddComponent(new Sprite("Content/Texture/wall.wpk"))
                         .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                         .AddComponent(new RectangleCollider())
                         .AddComponent(new Transform2D()
            {
                XScale = 1.55f,
                YScale = 2f,
            });

            var barBot = new Entity("BarBot")
                         .AddComponent(new Sprite("Content/Texture/wall.wpk"))
                         .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                         .AddComponent(new RectangleCollider())
                         .AddComponent(new Transform2D()
            {
                XScale = 1.55f,
                YScale = 2f,
                Y      = WaveServices.Platform.ScreenHeight - 25,
            });

            //Create Players
            var player = new Entity("Player")
                         .AddComponent(new Sprite("Content/Texture/player.wpk"))
                         .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                         .AddComponent(new RectangleCollider())
                         .AddComponent(new Transform2D()
            {
                Origin = new Vector2(0.5f, 1),
                X      = WaveServices.Platform.ScreenWidth / 50,
                Y      = WaveServices.Platform.ScreenHeight / 2
            })
                         .AddComponent(new PlayerBehavior());

            var player2 = new Entity("PlayerIA")
                          .AddComponent(new Sprite("Content/Texture/player.wpk"))
                          .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                          .AddComponent(new RectangleCollider())
                          .AddComponent(new Transform2D()
            {
                Origin = new Vector2(0.5f, 1),
                X      = WaveServices.Platform.ScreenWidth - 15,
                Y      = WaveServices.Platform.ScreenHeight / 2
            });

            //Create Ball
            var ball = new Entity("Ball")
                       .AddComponent(new Sprite("Content/Texture/ball.wpk"))
                       .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                       .AddComponent(new RectangleCollider())
                       .AddComponent(new Transform2D()
            {
                Origin = new Vector2(0.5f, 1),
                X      = WaveServices.Platform.ScreenWidth / 2,
                Y      = WaveServices.Platform.ScreenHeight / 2
            })
                       .AddComponent(new BallBehavior(player, barBot, barTop, player2));


            //Trophy components
            trophy.AddComponent(new Sprite("Content/Texture/trophy.wpk"));
            trophy.AddComponent(new SpriteRenderer(DefaultLayers.Alpha));
            trophy.AddComponent(new Transform2D());
            trophy.IsVisible = false;


            //Add component AI or Second Player controller
            if (WaveServices.ScreenContextManager.CurrentContext.Name == "FromSingleplayer")
            {
                player2.AddComponent(new PlayerAIBehavior(ball));
            }
            else if (WaveServices.ScreenContextManager.CurrentContext.Name == "FromMultiplayer")
            {
                player2.AddComponent(new Player2Behavior());
            }

            //Create Back Button
            var backButtonEntity = new Entity("BackButton")
                                   .AddComponent(new Transform2D())
                                   .AddComponent(new TextControl()
            {
                Text = "Back",
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Bottom,
                Foreground          = Color.Black,
            })
                                   .AddComponent(new TextControlRenderer())
                                   .AddComponent(new RectangleCollider())
                                   .AddComponent(new TouchGestures());

            backButtonEntity.FindComponent <TouchGestures>().TouchPressed += new EventHandler <GestureEventArgs>(Back_TouchPressed);

            //Create a sound bank and sound info for game
            SoundBank bank = new SoundBank(Assets);

            WaveServices.SoundPlayer.RegisterSoundBank(bank);

            soundPong = new SoundInfo("Content/Sound/SoundPong.wpk");
            bank.Add(soundPong);

            soundGoal = new SoundInfo("Content/Sound/SoundGol.wpk");
            bank.Add(soundGoal);

            //Add entities
            EntityManager.Add(backButtonEntity);
            EntityManager.Add(textblockInit);
            EntityManager.Add(player);
            EntityManager.Add(player2);
            EntityManager.Add(ball);
            EntityManager.Add(textblockGoal1);
            EntityManager.Add(textblockGoal2);
            EntityManager.Add(barTop);
            EntityManager.Add(barBot);
            EntityManager.Add(trophy);
            EntityManager.Add(background);

            //Add Scene Behavior Post Update
            AddSceneBehavior(new MySceneBehavior(), SceneBehavior.Order.PostUpdate);
        }
 public Tower_Chandler(int x, int y, int counter, string sprite)
     : base(x,y,counter,sprite)
 {
     Console.WriteLine("GOT CHANDLER TOWER !");
        sample = new SoundInfo("Content/Towers/Tower_Chandler/whip_chandler.wpk");
        SoundBank = new SoundBank();
        SoundBank.Add(sample);
        WaveServices.SoundPlayer.RegisterSoundBank(SoundBank);
 }
Exemple #17
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D") { BackgroundColor = Color.Black };
            EntityManager.Add(camera2D);

            int offsetTop = 50;

            //Create BackGround
            var background = new Entity("Background")
                            .AddComponent(new Sprite("Content/Texture/real-pong.wpk"))
                            .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                            .AddComponent(new Transform2D()
                            {
                                XScale = 1.5f,
                                YScale = 1.45f,
                            });

            //Create UI
            textblockGoal1 = new TextBlock("Goal1")
                            {
                                Margin = new Thickness((WaveServices.Platform.ScreenWidth / 2f) - 100, offsetTop, 0, 0),
                                FontPath = "Content/Font/Calisto MT.wpk",
                                Text = "0",
                                Height = 130,
                            };



            textblockGoal2 = new TextBlock("Goal2")
                            {
                                Margin = new Thickness((WaveServices.Platform.ScreenWidth / 2f) + 50, offsetTop, 0, 0),
                                FontPath = "Content/Font/Calisto MT.wpk",
                                Text = "0",
                                Height = 130,
                            };


            textblockInit = new TextBlock("TextInit")
                            {
                                Margin = new Thickness((WaveServices.Platform.ScreenWidth / 2f) - 50, offsetTop + 150, 0, 0),
                                FontPath = "Content/Font/Calisto MT.wpk",
                                Text = "",
                                Height = 130,
                                IsVisible = false,
                            };


            //Create Borders
            var barTop = new Entity("BarTop")
                .AddComponent(new Sprite("Content/Texture/wall.wpk"))
                            .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                            .AddComponent(new RectangleCollider())
                            .AddComponent(new Transform2D()
                            {
                                XScale = 1.55f,
                                YScale = 2f,                                
                            });

            var barBot = new Entity("BarBot")
                            .AddComponent(new Sprite("Content/Texture/wall.wpk"))
                            .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                            .AddComponent(new RectangleCollider())
                            .AddComponent(new Transform2D()
                            {
                                XScale = 1.55f,
                                YScale = 2f,
                                Y = WaveServices.Platform.ScreenHeight - 25,                                
                            });

            //Create Players
            var player = new Entity("Player")
                           .AddComponent(new Sprite("Content/Texture/player.wpk"))
                           .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                           .AddComponent(new RectangleCollider())
                           .AddComponent(new Transform2D()
                           {
                               Origin = new Vector2(0.5f, 1),
                               X = WaveServices.Platform.ScreenWidth / 50,
                               Y = WaveServices.Platform.ScreenHeight / 2
                           })
                           .AddComponent(new PlayerBehavior());

            var player2 = new Entity("PlayerIA")
                           .AddComponent(new Sprite("Content/Texture/player.wpk"))
                           .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                           .AddComponent(new RectangleCollider())
                           .AddComponent(new Transform2D()
                           {
                               Origin = new Vector2(0.5f, 1),
                               X = WaveServices.Platform.ScreenWidth - 15,
                               Y = WaveServices.Platform.ScreenHeight / 2
                           });

            //Create Ball
            var ball = new Entity("Ball")
                          .AddComponent(new Sprite("Content/Texture/ball.wpk"))
                          .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                          .AddComponent(new RectangleCollider())
                          .AddComponent(new Transform2D()
                          {
                              Origin = new Vector2(0.5f, 1),
                              X = WaveServices.Platform.ScreenWidth / 2,
                              Y = WaveServices.Platform.ScreenHeight / 2
                          })
                          .AddComponent(new BallBehavior(player, barBot, barTop, player2));


            //Trophy components               
            trophy.AddComponent(new Sprite("Content/Texture/trophy.wpk"));
            trophy.AddComponent(new SpriteRenderer(DefaultLayers.Alpha));
            trophy.AddComponent(new Transform2D());
            trophy.IsVisible = false;


            //Add component AI or Second Player controller
            if (WaveServices.ScreenContextManager.CurrentContext.Name == "FromSingleplayer")
                player2.AddComponent(new PlayerAIBehavior(ball));
            else if (WaveServices.ScreenContextManager.CurrentContext.Name == "FromMultiplayer")
                player2.AddComponent(new Player2Behavior());

            //Create Back Button
            var backButtonEntity = new Entity("BackButton")
                           .AddComponent(new Transform2D())
                           .AddComponent(new TextControl()
                           {
                               Text = "Back",
                               HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                               VerticalAlignment = WaveEngine.Framework.UI.VerticalAlignment.Bottom,
                               Foreground = Color.Black,
                           })
                           .AddComponent(new TextControlRenderer())
                           .AddComponent(new RectangleCollider())
                           .AddComponent(new TouchGestures());

            backButtonEntity.FindComponent<TouchGestures>().TouchPressed += new EventHandler<GestureEventArgs>(Back_TouchPressed);

            //Create a sound bank and sound info for game
            SoundBank bank = new SoundBank(Assets);
            WaveServices.SoundPlayer.RegisterSoundBank(bank);

            soundPong = new SoundInfo("Content/Sound/SoundPong.wpk");
            bank.Add(soundPong);

            soundGoal = new SoundInfo("Content/Sound/SoundGol.wpk");
            bank.Add(soundGoal);

            //Add entities
            EntityManager.Add(backButtonEntity);
            EntityManager.Add(textblockInit);
            EntityManager.Add(player);
            EntityManager.Add(player2);
            EntityManager.Add(ball);
            EntityManager.Add(textblockGoal1);
            EntityManager.Add(textblockGoal2);
            EntityManager.Add(barTop);
            EntityManager.Add(barBot);
            EntityManager.Add(trophy);
            EntityManager.Add(background);

            //Add Scene Behavior Post Update
            AddSceneBehavior(new MySceneBehavior(), SceneBehavior.Order.PostUpdate);
        }