Exemplo n.º 1
0
        protected override void CreateScene()
        {
            // Create a 2D camera
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.CornflowerBlue
            };

            EntityManager.Add(camera2D);

            Entity crate = new Entity("crate")
                           .AddComponent(new Transform2D()
            {
                X = 270, Y = 150, Origin = Vector2.Center
            })
                           .AddComponent(new RectangleCollider())
                           .AddComponent(new Sprite("Content/Crate.wpk"))
                           .AddComponent(new RigidBody2D())
                           .AddComponent(new SpriteRenderer(DefaultLayers.Opaque));

            Entity Wheel1 = new Entity("wheel1")
                            .AddComponent(new Transform2D()
            {
                X = 300, Y = 400, Origin = Vector2.Center
            })
                            .AddComponent(new CircleCollider())
                            .AddComponent(new Sprite("Content/Wheel.wpk"))
                            .AddComponent(new RigidBody2D())
                            .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            Entity Wheel2 = new Entity("wheel2")
                            .AddComponent(new Transform2D()
            {
                X = 450, Y = 400, Origin = Vector2.Center
            })
                            .AddComponent(new CircleCollider())
                            .AddComponent(new Sprite("Content/Wheel.wpk"))
                            .AddComponent(new RigidBody2D())
                            .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                            .AddComponent(new JointMap2D().AddJoint("simpleJoint", new DistanceJoint2D(Wheel1, Vector2.Zero, Vector2.Zero)));

            Entity ground = new Entity("ground")
                            .AddComponent(new Transform2D()
            {
                X = 400, Y = 500, Origin = Vector2.Center
            })
                            .AddComponent(new RectangleCollider())
                            .AddComponent(new Sprite("Content/Ground.wpk"))
                            .AddComponent(new RigidBody2D()
            {
                PhysicBodyType = PhysicBodyType.Static
            })
                            .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));


            EntityManager.Add(crate);
            EntityManager.Add(Wheel1);
            EntityManager.Add(Wheel2);
            EntityManager.Add(ground);
        }
Exemplo n.º 2
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

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

            this.CreateClosures();

            Entity wheel = new Entity("Wheel")
                           .AddComponent(new Transform2D()
            {
                X = 400, Y = 300, Origin = Vector2.Center
            })
                           .AddComponent(new CircleCollider())
                           .AddComponent(new Sprite("Content/Wheel.wpk"))
                           .AddComponent(new RigidBody2D()
            {
                PhysicBodyType = PhysicBodyType.Dynamic, Friction = 1
            })
                           .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                           .AddComponent(new ForceBehavior("ForceBehavior"));

            EntityManager.Add(wheel);
        }
Exemplo n.º 3
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.CornflowerBlue
            };

            this.EntityManager.Add(camera2D);

            //Create my entity with random start position.
            var random = WaveServices.Random;
            var sprite = string.Format("Content/Assets/c{0}.png", this.playerSpriteIndex);

            this.playerEntity = new Entity("Player_" + this.playerSpriteIndex)
                                .AddComponent(new Transform2D
            {
                Position  = new Vector2(random.Next(10, 800), random.Next(10, 200)),
                DrawOrder = 1.0f / this.playerSpriteIndex
            })
                                .AddComponent(new Sprite(sprite))
                                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                                .AddComponent(new NetworkBehavior())
                                .AddComponent(new SyncPositionComponent())
                                .AddComponent(new MovementBehavior());

            EntityManager.Add(this.playerEntity);
        }
Exemplo n.º 4
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = this.backgroundColor
            };

            EntityManager.Add(camera2D);

            // Water particles
            Entity waterParticles = new Entity("waterParticles")
                                    .AddComponent(new Transform2D()
            {
                X = WaveServices.ViewportManager.VirtualWidth / 2,
                Y = WaveServices.ViewportManager.VirtualHeight / 2,
            })
                                    .AddComponent(ParticleFactory.CreateWaterParticles())
                                    .AddComponent(new Material2D(new BasicMaterial2D(Directories.TexturePath + "waterParticle.wpk", DefaultLayers.Additive)))
                                    .AddComponent(new ParticleSystemRenderer2D("waterParticles"));

            EntityManager.Add(waterParticles);

            Entity waterParticles2 = new Entity("waterParticles2")
                                     .AddComponent(new Transform2D()
            {
                X = WaveServices.ViewportManager.VirtualWidth / 2,
                Y = WaveServices.ViewportManager.VirtualHeight / 2,
            })
                                     .AddComponent(ParticleFactory.CreateWaterParticles())
                                     .AddComponent(new Material2D(new BasicMaterial2D(Directories.TexturePath + "waterParticle2.wpk", DefaultLayers.Additive)))
                                     .AddComponent(new ParticleSystemRenderer2D("waterParticles2"));

            EntityManager.Add(waterParticles2);
        }
Exemplo n.º 5
0
        protected override void CreateScene()
        {
            var camera = new FixedCamera2D("MainCamera");

            this.EntityManager.Add(camera);

            var internetWaveLogo = new Entity()
                                   .AddComponent(new Transform2D()
            {
                Origin = Vector2.Center,
                X      = WaveServices.ViewportManager.VirtualWidth * 0.5f,
                Y      = WaveServices.ViewportManager.VirtualHeight * 0.1f,
            })
                                   .AddComponent(new SpriteUrl("Content/Loading.png", "https://raw.githubusercontent.com/WaveEngine/Samples/master/Core/InternetTextureLoad/Images/logo.png"))
                                   .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            EntityManager.Add(internetWaveLogo);

            var internetWaveBanner = new Entity()
                                     .AddComponent(new Transform2D()
            {
                Origin = Vector2.Center,
                X      = WaveServices.ViewportManager.VirtualWidth * 0.5f,
                Y      = WaveServices.ViewportManager.VirtualHeight * 0.7f,
            })
                                     .AddComponent(new SpriteUrl("Content/Loading.png", "https://raw.githubusercontent.com/WaveEngine/Samples/master/Core/InternetTextureLoad/Images/banner.png"))
                                     .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            EntityManager.Add(internetWaveBanner);
        }
Exemplo n.º 6
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                ClearFlags = ClearFlags.DepthAndStencil, BackgroundColor = Color.Transparent
            };

            EntityManager.Add(camera2D);

            this.gameStorage = Catalog.GetItem <GameStorage>();
            this.gameScene   = WaveServices.ScreenContextManager.FindContextByName("GamePlay")
                               .FindScene <GamePlayScene>();

            if (this.gameStorage.BestScore < this.gameScene.CurrentScore)
            {
                // Update best score
                this.gameStorage.BestScore = this.gameScene.CurrentScore;

                // Save storage game data
                GameStorage gameStorage = Catalog.GetItem <GameStorage>();
                WaveServices.Storage.Write <GameStorage>(gameStorage);
            }

            this.CreateUI();

            // Music Volume
            WaveServices.MusicPlayer.Volume = 0.2f;

            // Animations
            Duration duration = TimeSpan.FromSeconds(1);

            this.scaleAppear   = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.opacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            // Scene behaviors
            this.AddSceneBehavior(new StartSceneBehavior(), SceneBehavior.Order.PostUpdate);

            // Creates a 2D camera
            var camera2D = new FixedCamera2D("Camera2D")
            {
                ClearFlags = ClearFlags.DepthAndStencil
            };                                                                                        // Transparent background need this clearFlags.

            this.EntityManager.Add(camera2D);

            // "Catch to Start" Text
            var startTextBlock = new TextBlock("StartEntity")
            {
                Width  = 885,
                Height = 65,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                TextAlignment       = TextAlignment.Center,
                FontPath            = "Content/PFDarkBigFont",
                Text       = "Catch this to START",
                Foreground = Color.Red,
            };

            startTextBlock.Entity.AddComponent(new BlinkBehavior(TimeSpan.FromSeconds(0.2f))
            {
                MinOpacity = 0.4f
            });
            this.EntityManager.Add(startTextBlock);
        }
Exemplo n.º 8
0
        protected override void CreateScene()
        {
            #region Simple test
            //Create a 3D camera
            var camera3D = new FreeCamera("Camera3D", new Vector3(0, 2, 4), Vector3.Zero)
            {
                BackgroundColor = Color.CornflowerBlue
            };
            EntityManager.Add(camera3D);

            // Create a 2D camera
            var camera2D = new FixedCamera2D("Camera2D")
            {
                ClearFlags = ClearFlags.DepthAndStencil
            };                                                                                                     // Transparent background need this clearFlags.
            EntityManager.Add(camera2D);


            // Generator
            int time = WaveServices.Random.Next(1, 5);
            WaveServices.TimerFactory.CreateTimer("AntGenerator", TimeSpan.FromSeconds((float)time), () =>
            {
                Ant ant = new Ant();
                EntityManager.Add(ant.GetEntity());
            }, true);

            int timeCockroach = WaveServices.Random.Next(4, 6);
            WaveServices.TimerFactory.CreateTimer("CockroachGenerator", TimeSpan.FromSeconds((float)timeCockroach), () =>
            {
                Cockroach cockroach = new Cockroach();
                EntityManager.Add(cockroach.GetEntity());
            }, true);

            #endregion
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.CornflowerBlue
            };

            EntityManager.Add(camera2D);

            // Create Phsyic Borders
            this.CreateClosures();

            // Creates Box Stack
            for (int i = 0; i < STACKHEIGHT; i++)
            {
                for (int j = 0; j < STACKWIDTH; j++)
                {
                    Entity box = this.CreateCrate(200 + j * 45, 335 + (STACKHEIGHT - i) * 42);
                    EntityManager.Add(box);
                }
            }

            // Adds Mouse control. See MouseBehavior.cs for details.
            this.AddSceneBehavior(new MouseBehavior(), SceneBehavior.Order.PostUpdate);
        }
Exemplo n.º 11
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            this.AddSceneBehavior(new MySceneBehavior(), SceneBehavior.Order.PreUpdate);

            var camera2d = new FixedCamera2D("defaultCamera2D");

            camera2d.BackgroundColor = Color.CadetBlue;
            this.EntityManager.Add(camera2d);

            //var sprite1 = new Entity("tree")
            //     .AddComponent(new Transform2D())
            //     .AddComponent(new Sprite(WaveContent.Assets.tree2_png))
            //     .AddComponent(new SpriteRenderer());
            //this.EntityManager.Add(sprite1);
            //sprite1.FindComponent<Transform2D>().LocalScale = new Vector2(.25f);

            var sprite2 = new Entity("ball")
                          .AddComponent(new Transform2D())
                          .AddComponent(new Sprite(WaveContent.Assets.ball_png))
                          .AddComponent(new SpriteRenderer());

            this.EntityManager.Add(sprite2);
            sprite2.FindComponent <Transform2D>().LocalScale = new Vector2(.25f);

            var sprite3 = new Entity("field")
                          .AddComponent(new Transform2D())
                          .AddComponent(new Sprite(WaveContent.Assets.field_png))
                          .AddComponent(new SpriteRenderer());

            this.EntityManager.Add(sprite3);
            sprite3.FindComponent <Transform2D>().LocalScale = new Vector2(.89f);
        }
Exemplo n.º 12
0
        private void CreateCamera()
        {
            // Create a 2D camera
            var camera = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = new Color("#5a93e0"),
            };

            var camera2DComponent = camera.Entity.FindComponent <Camera2D>();

            camera2DComponent.Zoom = Vector2.One / 2.5f;

            #region Lens Effects
            ////if (WaveServices.Platform.PlatformType == PlatformType.Windows ||
            ////    WaveServices.Platform.PlatformType == PlatformType.Linux ||
            ////    WaveServices.Platform.PlatformType == PlatformType.MacOS)
            ////{
            ////    camera.Entity.AddComponent(ImageEffects.FishEye());
            ////    camera.Entity.AddComponent(new ChromaticAberrationLens() { AberrationStrength = 5.5f });
            ////    camera.Entity.AddComponent(new RadialBlurLens() { Center = new Vector2(0.5f, 0.75f), BlurWidth = 0.02f, Nsamples = 5 });
            ////    camera.Entity.AddComponent(ImageEffects.Vignette());
            ////    camera.Entity.AddComponent(new FilmGrainLens() { GrainIntensityMin = 0.075f, GrainIntensityMax = 0.15f });
            ////}
            #endregion

            EntityManager.Add(camera);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Creates Main Scene
        /// </summary>
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

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

            // Border and UI
            this.CreateClosures();
            this.CreateUI();

            // Sample Crate and Collision Event Register
            Entity      box          = this.CreateCrate(200, 100);
            RigidBody2D boxRigidBody = box.FindComponent <RigidBody2D>();

            if (boxRigidBody != null)
            {
                boxRigidBody.OnPhysic2DCollision += BoxRigidBody_OnPhysic2DCollision;
            }
            EntityManager.Add(box);

            // Sample Circle and Collision Event register
            Entity      circle          = this.CreateCircle(600, 100);
            RigidBody2D circleRigidBody = circle.FindComponent <RigidBody2D>();

            if (circleRigidBody != null)
            {
                circleRigidBody.OnPhysic2DCollision += CircleRigidBody_OnPhysic2DCollision;
            }
            EntityManager.Add(circle);

            // Mouse Handler.
            this.AddSceneBehavior(new MouseBehavior(), SceneBehavior.Order.PostUpdate);
        }
Exemplo n.º 14
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

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

            System.Random rnd = new System.Random(23);

            CreateBackground();

            this.gameplayBehavior = new GameplayBehavior();

            this.gameplayBehavior.Scored += gameplayBehavior_Scored;

            this.AddSceneBehavior(this.gameplayBehavior, SceneBehavior.Order.PostUpdate);

            this.CreatePlanet();

            CreatePlayer();

            CreateEnemies(rnd);

            CreateStars();

            CreateHUD();

            this.gameplayBehavior.Reset();
        }
Exemplo n.º 15
0
        protected override void CreateScene()
        {
            //Create a 3D camera
            var camera3D = new FixedCamera("Camera3D", new Vector3(2f, 0f, 2.8f), new Vector3(.5f, 0, 0))
            {
                BackgroundColor = backgroundColor
            };

            EntityManager.Add(camera3D);

            this.CreateCube3D();

            // Create a 2D camera
            var camera2D = new FixedCamera2D("Camera2D")
            {
                ClearFlags = ClearFlags.DepthAndStencil
            };                                                                                        // Transparent background need this clearFlags.

            EntityManager.Add(camera2D);

            this.CreateSliders();

            this.CreateGrid();

            this.CreateDebugMode();
        }
Exemplo n.º 16
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            // Create a 2D camera
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.CornflowerBlue
            };

            EntityManager.Add(camera2D);

            // Create Border limits with "Category.All" CollisionGroup (colliding bodies no matter the body collision category)
            this.CreateClosures();


            // Create other collision group. Category 3
            for (int i = 0; i < 5; i++)
            {
                EntityManager.Add(this.CreateCircle(200 + i * 100, 200, CIRCLE_TEXTURE, Physic2DCategory.Cat3));
            }

            // Create other collision group. Category 2
            for (int i = 0; i < 10; i++)
            {
                EntityManager.Add(this.CreateCrate(200 + i * 50, 200, CRATEB_TEXTURE, Physic2DCategory.Cat2));
            }

            // Create a Collision Group. Category 1
            for (int i = 0; i < 10; i++)
            {
                EntityManager.Add(this.CreateCrate(200 + i * 50, 300, CRATEA_TEXTURE, Physic2DCategory.Cat1));
            }

            // Mouse drag controller
            this.AddSceneBehavior(new MouseBehavior(), SceneBehavior.Order.PostUpdate);
        }
Exemplo n.º 17
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.CornflowerBlue
            };

            this.EntityManager.Add(camera2D);

            this.messageTextBlock = new TextBlock()
            {
                Width  = 600,
                Height = 50,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Bottom,
                Margin = new Thickness(10, 0, 10, 10)
            };
            this.EntityManager.Add(this.messageTextBlock);

            this.playerEntity = new Entity("SelectedPlayer")
                                .AddComponent(new Transform2D
            {
                Position = new Vector2(100, 100),
            })
                                .AddComponent(new Sprite())
                                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));
            this.EntityManager.Add(this.playerEntity);

            this.SendHelloToServer();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                ClearFlags = ClearFlags.DepthAndStencil
            };

            EntityManager.Add(camera2D);

            //RenderManager.BackgroundColor = new Color(0 / 255f, 31 / 255f, 39 / 255f);

            //Backscene
            this.backScene = WaveServices.ScreenContextManager.FindContextByName("BackContext")
                             .FindScene <BackgroundScene>();

            // Side black panels
            Entity rightBlackpanel = new Entity()
                                     .AddComponent(new Transform2D()
            {
                DrawOrder = 1f,
                X         = WaveServices.ViewportManager.LeftEdge
            })
                                     .AddComponent(new ImageControl(
                                                       Color.Black,
                                                       (int)-WaveServices.ViewportManager.LeftEdge,
                                                       (int)WaveServices.ViewportManager.VirtualHeight))
                                     .AddComponent(new ImageControlRenderer(DefaultLayers.GUI));

            EntityManager.Add(rightBlackpanel);

            Entity leftBlackpanel = new Entity()
                                    .AddComponent(new Transform2D()
            {
                DrawOrder = 1f,
                X         = WaveServices.ViewportManager.VirtualWidth
            })
                                    .AddComponent(new ImageControl(
                                                      Color.Black,
                                                      (int)-WaveServices.ViewportManager.LeftEdge,
                                                      (int)WaveServices.ViewportManager.VirtualHeight))
                                    .AddComponent(new ImageControlRenderer(DefaultLayers.GUI));

            EntityManager.Add(leftBlackpanel);

            // Squid
            this.squid = new Squid(WaveServices.ViewportManager.VirtualHeight - 300);
            EntityManager.Add(this.squid);

            // Rocks
            this.blockBuilder = new BlockBuilder();
            EntityManager.Add(this.blockBuilder);

            // ScorePanel
            this.scorePanel = new ScorePanel();
            EntityManager.Add(scorePanel);

            // Scene Behaviors
            this.AddSceneBehavior(new DebugSceneBehavior(), SceneBehavior.Order.PostUpdate);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

            camera2d.ClearFlags = ClearFlags.DepthAndStencil;
            EntityManager.Add(camera2d);

            // Music Player
            MusicInfo musicInfo = new MusicInfo("Content/audiodolby.mp3");

            WaveServices.MusicPlayer.Play(musicInfo);
            WaveServices.MusicPlayer.IsRepeat = true;

            WaveServices.MusicPlayer.Play(new MusicInfo("Content/audiodolby.mp3"));
            WaveServices.MusicPlayer.IsDolbyEnabled = true;
            WaveServices.MusicPlayer.DolbyProfile   = DolbyProfiles.GAME;

            // Button Stack Panel
            buttonPanel = new StackPanel();
            buttonPanel.Entity.AddComponent(new AnimationUI());
            buttonPanel.VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Center;
            buttonPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;

            // Enable/Disable Dolby Button
            this.CreateButton(out this.enableDolbyButton, string.Empty, this.EnableDolbyButtonClick);
            buttonPanel.Add(this.enableDolbyButton);

            // Profile Buttons
            this.CreateButton(out this.profileGameButton, WaveEngine.Common.Media.DolbyProfiles.GAME.ToString(), this.ProfileGameButtonClick);
            buttonPanel.Add(this.profileGameButton);
            this.CreateButton(out this.profileMovieButton, WaveEngine.Common.Media.DolbyProfiles.MOVIE.ToString(), this.ProfileMovieButtonClick);
            buttonPanel.Add(this.profileMovieButton);
            this.CreateButton(out this.profileMusicButton, WaveEngine.Common.Media.DolbyProfiles.MUSIC.ToString(), this.ProfileMusicButtonClick);
            buttonPanel.Add(this.profileMusicButton);
            this.CreateButton(out this.profileVoiceButton, WaveEngine.Common.Media.DolbyProfiles.VOICE.ToString(), this.ProfileVoiceButtonClick);
            buttonPanel.Add(this.profileVoiceButton);
            EntityManager.Add(buttonPanel);

            // Information Text
            infoPanel = new StackPanel();
            infoPanel.Entity.AddComponent(new AnimationUI());
            infoPanel.VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Bottom;
            infoPanel.HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center;

            infoPanel.Orientation = Orientation.Vertical;
            this.CreateLabel(out this.isDolbyEnabledTextBox, string.Empty);
            infoPanel.Add(this.isDolbyEnabledTextBox);
            this.CreateLabel(out this.selectedDolbyProfileTextBox, string.Empty);
            infoPanel.Add(this.selectedDolbyProfileTextBox);
            EntityManager.Add(infoPanel);

            // Sets text
            this.SetDolbyText();

            //// Animations
            this.fadeIn = new SingleAnimation(0.0f, 1.0f, TimeSpan.FromSeconds(8), EasingFunctions.Cubic);
        }
Exemplo n.º 20
0
        protected override void CreateScene()
        {
            // Create a 2D camera
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.CornflowerBlue
            };

            EntityManager.Add(camera2D);

            // Scene creation
            Entity Wheel1 = this.CreateWheel("Wheel1", 150, 300);

            EntityManager.Add(Wheel1);

            Entity Pin1 = this.CreatePin("Pin1", 200, 200);

            EntityManager.Add(Pin1);

            Pin1.AddComponent(new JointMap2D().AddJoint("joint1", new DistanceJoint2D(Wheel1, Vector2.Zero, Vector2.Zero)));

            Entity Wheel2 = this.CreateWheel("Wheel2", 550, 300);

            EntityManager.Add(Wheel2);

            Entity Pin2 = this.CreatePin("Pin2", 600, 200);

            EntityManager.Add(Pin2);

            Pin2.AddComponent(new JointMap2D().AddJoint("joint2", new DistanceJoint2D(Wheel2, Vector2.Zero, Vector2.Zero)));

            // ANGLE JOINT between wheels
            Wheel2.AddComponent(new JointMap2D().AddJoint("joint3", new AngleJoint2D(Wheel1)));

            // Create Ground
            Entity ground = this.CreateGround("ground", 400, 500);

            EntityManager.Add(ground);

            Entity ground2 = this.CreateGround("ground2", 950, 400);

            EntityManager.Add(ground2);

            // Falling Crates controller
            WaveServices.TimerFactory.CreateTimer("CrateFallingTimer", TimeSpan.FromSeconds(2f), () =>
            {
                this.CreateFallingCrate(255);

                if (this.repeats == 10)
                {
                    JointMap2D pinJointMap = Pin2.FindComponent <JointMap2D>();

                    pinJointMap.RemoveJoint("joint2");
                }
            });
        }
Exemplo n.º 21
0
        private void CreateCamera()
        {
            // Camera
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.BurlyWood
            };

            EntityManager.Add(camera2D);
        }
Exemplo n.º 22
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

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

            MusicInfo musicInfo = new MusicInfo("Content/ByeByeBrain.mp3");

            WaveServices.MusicPlayer.Play(musicInfo);
        }
Exemplo n.º 23
0
        protected override void CreateScene()
        {
            //throw new NotImplementedException();
            FixedCamera2D camera = new FixedCamera2D("Camera");
            camera.Entity.AddComponent(new CameraTrackBehaviour(player, new Rectangle(0, 0, map.getWidth(), map.getHeight())));
            EntityManager.Add(camera);

            EntityManager.Add(map);
            EntityManager.Add(player);

        }
Exemplo n.º 24
0
        protected override void CreateScene()
        {
            // Create a 2D camera
            var camera2D = new FixedCamera2D("Camera2D");

            EntityManager.Add(camera2D);

            Image image = new Image("Content/Start.png");

            EntityManager.Add(image);
        }
Exemplo n.º 25
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera")
            {
                BackgroundColor = Color.Black,
                ClearFlags      = ClearFlags.DepthAndStencil,
            };

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

            Entity logo = new Entity()
                          .AddComponent(new Transform2D()
            {
                X = WaveServices.ViewportManager.VirtualWidth / 2, Y = 227, Origin = Vector2.Center, DrawOrder = 0.1f
            })
                          .AddComponent(new Sprite("Content/DeepSpace_logo.wpk"))
                          .AddComponent(new AnimationUI())
                          .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            this.labelAnimation = logo.FindComponent <AnimationUI>();

            this.EntityManager.Add(logo);

            var button = new Button()
            {
                Margin = new Thickness(0, 657, 0, 0),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Top,
                Text                   = string.Empty,
                IsBorder               = false,
                BackgroundImage        = "Content/PressStart.wpk",
                PressedBackgroundImage = "Content/PressStart.wpk"
            };

            button.Click += (o, e) =>
            {
                var gameScene = WaveServices.ScreenContextManager.FindContextByName("GamePlayContext").FindScene <GamePlayScene>();

                gameScene.State = GameState.Game;

                WaveServices.ScreenContextManager.Pop(new CrossFadeTransition(TimeSpan.FromSeconds(0.5f)));
                ////WaveServices.ScreenContextManager.Push(gameContext, new CrossFadeTransition(TimeSpan.FromSeconds(1.5f)));
            };

            button.Entity.AddComponent(new AnimationUI());
            this.playAnimation = button.Entity.FindComponent <AnimationUI>();

            this.EntityManager.Add(button);


            this.playScaleAppear   = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.playOpacityAppear = new SingleAnimation(0, 1, TimeSpan.FromSeconds(1), EasingFunctions.Cubic);
        }
Exemplo n.º 26
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D")
            {
                BackgroundColor = Color.CornflowerBlue
            };

            this.EntityManager.Add(camera2D);

            this.CreateUi();
        }
Exemplo n.º 27
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

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

            // Panel
            stackPanel = new StackPanel()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center,
                Width  = 400,
                Height = 400,
            };
            EntityManager.Add(stackPanel.Entity);

            // Elements
            Button button;

            for (int i = 0; i < 4; i++)
            {
                button = new Button()
                {
                    Text = i.ToString(),
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Center,
                    Width           = 100,
                    Height          = 100,
                    Foreground      = Color.Yellow,
                    BackgroundColor = Color.Red,
                };
                stackPanel.Add(button);
            }

            // Set Orientation
            Button button1 = new Button()
            {
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Bottom,
                Text            = "Change Orientation",
                Width           = 200,
                Margin          = new Thickness(20),
                Foreground      = Color.LightPink,
                BackgroundColor = Color.Purple,
                BorderColor     = Color.LightPink,
            };

            button1.Click += b_Click;
            EntityManager.Add(button1.Entity);

            // Debug
            this.CreateDebugMode();
        }
Exemplo n.º 28
0
        protected override void Start()
        {
            base.Start();

            FixedCamera2D camera2d = new FixedCamera2D("camera2d")
            {
                ClearFlags = ClearFlags.DepthAndStencil,
            };

            EntityManager.Add(camera2d);
            camera2d.Entity.FindComponent <Camera2D>().CenterScreen();
        }
Exemplo n.º 29
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        /// <remarks>
        /// This method is called before all
        /// <see cref="T:WaveEngine.Framework.Entity" /> instances in this instance are initialized.
        /// </remarks>
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

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

            //// Entities
            // Left Speaker
            this.leftSpeaker = this.CreateSpeaker(WaveServices.ViewportManager.LeftEdge, WaveServices.ViewportManager.VirtualHeight / 2, false, new Vector2(0.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakera.wpk", 0.5f);
            Entity leftChild = this.CreateSpeaker(0.0f, 0.0f, false, new Vector2(0.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakerb.wpk", 0.0f);

            leftChild.AddComponent(new BlinkBehavior());
            this.leftSpeaker.AddChild(leftChild);
            EntityManager.Add(this.leftSpeaker);

            // Right Speaker
            this.rightSpeaker = this.CreateSpeaker(WaveServices.ViewportManager.RightEdge, WaveServices.ViewportManager.VirtualHeight / 2, true, new Vector2(1.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakera.wpk", 0.5f);
            Entity rightChild = this.CreateSpeaker(0.0f, 0.0f, true, new Vector2(1.0f, 0.5f), new Vector2(1.0f, 1.0f), "Content/speakerb.wpk", 0.0f);

            rightChild.AddComponent(new BlinkBehavior());
            this.rightSpeaker.AddChild(rightChild);
            EntityManager.Add(this.rightSpeaker);

            // Dolby Logo
            this.dolbyLogo = new Entity()
                             .AddComponent(new Transform2D()
            {
                X = WaveServices.ViewportManager.VirtualWidth / 2, Y = WaveServices.ViewportManager.VirtualHeight / 2, Origin = Vector2.Center, DrawOrder = 0.5f, Opacity = 1
            })
                             .AddComponent(new AnimationUI())
                             .AddComponent(new Sprite("Content/logo.wpk"))
                             .AddComponent(new SpriteRenderer(DefaultLayers.GUI));
            EntityManager.Add(this.dolbyLogo);

            // Background
            this.background = new Entity()
                              .AddComponent(new Transform2D()
            {
                X = WaveServices.ViewportManager.VirtualWidth / 2, Y = 0, Origin = new Vector2(0.5f, 0), DrawOrder = 1.0f, XScale = 1.5f, YScale = 1.5f
            })
                              .AddComponent(new AnimationUI())
                              .AddComponent(new Sprite("Content/background.wpk"))
                              .AddComponent(new SpriteRenderer(DefaultLayers.GUI));
            EntityManager.Add(this.background);

            //// Animations
            this.fadeIn                 = new SingleAnimation(0, 1, TimeSpan.FromSeconds(3), EasingFunctions.Cubic);
            this.logoYTransform         = new SingleAnimation(WaveServices.ViewportManager.VirtualHeight / 2, 50, TimeSpan.FromSeconds(3), EasingFunctions.Cubic);
            this.backgoundYtransform    = new SingleAnimation(-50, -90, TimeSpan.FromSeconds(20), EasingFunctions.Cubic);
            this.leftSpeakerXtransform  = new SingleAnimation(-500, 0, TimeSpan.FromSeconds(6));
            this.rightSpeakerXtransform = new SingleAnimation(WaveServices.ViewportManager.RightEdge + 500, WaveServices.ViewportManager.RightEdge, TimeSpan.FromSeconds(6));
        }
Exemplo n.º 30
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");

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

            Entity panel = new Entity("TouchPanel")
                           .AddComponent(new TouchesRenderer("Content/Touch.wpk"));

            EntityManager.Add(panel);
        }