Inheritance: BaseDecorator
Esempio n. 1
0
        /// <summary>
        /// Create the camera
        /// </summary>
        private void CreateCamera()
        {
            FixedCamera2D camera = new FixedCamera2D("camera")
                {
                    NearPlane = -1000,
                    FarPlane = 30000,
                    FieldOfView = MathHelper.ToRadians(45),
                    VanishingPoint = new Vector2(0.5f, 0.95f),
                    BackgroundColor = SceneResources.BackgroundColor,
                };

            // Lens effects
            camera.Entity.AddComponent(new CameraBehavior(this.yurei.Entity));


            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 });
            }

            this.EntityManager.Add(camera);
        }
Esempio n. 2
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D") { BackgroundColor = Color.Black };
            EntityManager.Add(camera2D);

            int offset = 100;

            //var title = new Entity("Title")
            //                   .AddComponent(new Sprite("Content/Texture/TitlePong.wpk"))
            //                   .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
            //                   .AddComponent(new Transform2D()
            //                   {
            //                       Y = WaveServices.Platform.ScreenHeight / 2 - offset,
            //                       X = WaveServices.Platform.ScreenWidth / 2 - 150
            //                   });

            //EntityManager.Add(title);

            var multiplayerButtonEntity = new Entity("MultiplayerButton")
                                .AddComponent(new Transform2D()
                                {
                                    Y = WaveServices.Platform.ScreenHeight / 2 + 50,
                                    X = WaveServices.Platform.ScreenWidth / 2 - offset,
                                    XScale = 2f,
                                    YScale = 2f
                                })
                                .AddComponent(new TextControl()
                                {
                                    Text = "Multiplayer",
                                    Foreground = Color.White,
                                })
                                .AddComponent(new TextControlRenderer())
                                .AddComponent(new RectangleCollider())
                                .AddComponent(new TouchGestures());

            multiplayerButtonEntity.FindComponent<TouchGestures>().TouchPressed += new EventHandler<GestureEventArgs>(Multiplayer_TouchPressed);

            EntityManager.Add(multiplayerButtonEntity);

            var singleplayerButtonEntity = new Entity("SingleplayerButton")
                                .AddComponent(new Transform2D()
                                {
                                    Y = WaveServices.Platform.ScreenHeight / 2,
                                    X = WaveServices.Platform.ScreenWidth / 2 - offset,
                                    XScale = 2f,
                                    YScale = 2f
                                })
                                .AddComponent(new TextControl()
                                {
                                    Text = "Single Player",
                                    Foreground = Color.White,
                                })
                                .AddComponent(new TextControlRenderer())
                                .AddComponent(new RectangleCollider())
                                .AddComponent(new TouchGestures());

            singleplayerButtonEntity.FindComponent<TouchGestures>().TouchPressed += new EventHandler<GestureEventArgs>(Singleplayer_TouchPressed);

            EntityManager.Add(singleplayerButtonEntity);
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        protected override void CreateScene()
        {
            //Insert your scene definition here.

            #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);

            // Draw a cube
            Entity cube = new Entity()
                .AddComponent(new Transform3D())
                .AddComponent(Model.CreateCube())
                .AddComponent(new Spinner() { AxisTotalIncreases = new Vector3(1, 2, 3) })
                .AddComponent(new MaterialsMap())
                .AddComponent(new ModelRenderer());

            EntityManager.Add(cube);

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

            // Draw a simple sprite
            Entity sprite = new Entity()
                .AddComponent(new Transform2D())
                // Change this line for a custom assets "new Sprite("Content/MyTexture"))"
                // Manage assets using the Resources.weproj link to open the Assets Exporter tool.
                .AddComponent(new Sprite(StaticResources.DefaultTexture))
                .AddComponent(new SpriteRenderer(DefaultLayers.Opaque));

            EntityManager.Add(sprite);
            #endregion
        }
Esempio n. 5
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");
            camera2d.BackgroundColor = Color.CornflowerBlue;
            EntityManager.Add(camera2d);

            // Creates Car Body
            Entity body = this.CreateBody("body", 90, 100);
            EntityManager.Add(body);

            // Creates Motor Wheel
            Entity wheel1 = this.CreateWheel("Wheel1", 90, 100);
            EntityManager.Add(wheel1);
            wheel1.AddComponent(new JointMap2D()
                                        .AddJoint("joint", new RevoluteJoint2D(body, Vector2.Zero, new Vector2(-70, 0))
                                                                        {
                                                                            MotorEnabled = true,
                                                                            MotorMaxTorque = 1000f,
                                                                            MotorTorque = 100f
                                                                        }
                                                  )
                                 );
            wheel1.AddComponent(new MotorBehavior("MotorBehavior"));

            // Creates Second WHeel
            Entity wheel2 = this.CreateWheel("Wheel2", 210, 100);
            EntityManager.Add(wheel2);
            wheel2.AddComponent(new JointMap2D()
                                            .AddJoint("joint", new RevoluteJoint2D(body, Vector2.Zero, new Vector2(70, 0))));

            // Create Ground and ramps
            this.CreateWalls();
        }
Esempio n. 6
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);
        }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D") { BackgroundColor = Color.CornflowerBlue };
            this.EntityManager.Add(camera2D);

            this.CreateUi();
        }
        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();
        }
Esempio n. 11
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")
            {
                BackgroundColor = Color.CornflowerBlue
            };
            EntityManager.Add(camera2D);


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

            EntityManager.Add(ground);

            Entity circle = new Entity("Circle")
                .AddComponent(new Transform2D() { X = 450, Origin = Vector2.Center })
                .AddComponent(new Sprite("Content/circleSprite.wpk"))
                .AddComponent(new CircleCollider())
                .AddComponent(new RigidBody2D())
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            EntityManager.Add(circle);

            for (int i = 0; i < 8; i++)
            {
                Entity box = CreateBox(i.ToString(), 300 + i * 5, i * -50);
                EntityManager.Add(box);
            }
        }
Esempio n. 12
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();
        }
Esempio n. 13
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);
        }
Esempio n. 14
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);
        }
Esempio n. 15
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);
        }
Esempio n. 16
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);
        }
Esempio n. 17
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");
            EntityManager.Add(camera2d);

            var credits = new TextBlock()
            {
                Text = "Braid's art copyright from their original owners\n" +
                       "Sprites from Cyrus Annihilator, background from David Hellman's web\n" +
                       "We just love this game and wanted to make a small tribute within this sample :-)",
                Margin = new Thickness(10, 10, 0, 0),
                Foreground = Color.Black
            };

            var sky = new Entity("Sky")
                .AddComponent(new Sprite("Content/Sky.wpk"))
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                .AddComponent(new Transform2D()
                {
                    Origin = new Vector2(0.5f, 1),
                    X = WaveServices.Platform.ScreenWidth / 2,
                    Y = WaveServices.Platform.ScreenHeight
                });
            var floor = new Entity("Floor")
                .AddComponent(new Sprite("Content/Floor.wpk"))
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha))
                .AddComponent(new Transform2D()
                {
                    Origin = new Vector2(0.5f, 1),
                    X = WaveServices.Platform.ScreenWidth / 2,
                    Y = WaveServices.Platform.ScreenHeight
                });

            // Tim
            var tim = new Entity("Tim")
                .AddComponent(new Transform2D()
                {
                    X = WaveServices.Platform.ScreenWidth / 2,
                    Y = WaveServices.Platform.ScreenHeight - 46,
                    Origin = new Vector2(0.5f, 1)
                })
                .AddComponent(new Sprite("Content/TimSpriteSheet.wpk"))
                .AddComponent(Animation2D.Create<TexturePackerGenericXml>("Content/TimSpriteSheet.xml")
                    .Add("Idle", new SpriteSheetAnimationSequence() { First = 1, Length = 22, FramesPerSecond = 11 })
                    .Add("Running", new SpriteSheetAnimationSequence() { First = 23, Length = 27, FramesPerSecond = 27 }))
                .AddComponent(new AnimatedSpriteRenderer())
                .AddComponent(new TimBehavior());

            // We add the floor the first so the rocks are on top of Tim
            EntityManager.Add(credits.Entity);
            EntityManager.Add(floor);
            EntityManager.Add(tim);
            EntityManager.Add(sky);

            var anim2D = tim.FindComponent<Animation2D>();
            anim2D.Play(true);
        }
Esempio n. 18
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);
            
        }      
Esempio n. 19
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);
        }
Esempio n. 20
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);
        }
Esempio n. 21
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);
        }
Esempio n. 22
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();
        }
Esempio n. 23
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");
                }
            });
        }
Esempio n. 24
0
        protected override void CreateScene()
        {
            var camera2D = new FixedCamera2D("Camera2D");
            camera2D.BackgroundColor = Color.Black;
            EntityManager.Add(camera2D);

            background = new Entity()
                .AddComponent(new Transform2D()
                {
                    Origin = Vector2.Center,
                    DrawOrder = 1f,
                    XScale = 4f,
                    YScale = 4f,
                })
                .AddComponent(new Sprite("Content/Background")
                {
                    TintColor = new Color(255 - 71, 255 - 80, 255 - 87),
                })
                .AddComponent(new AnimationUI())
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            EntityManager.Add(background);

            tower = new Entity()
                .AddComponent(new Transform2D()
                {
                    Origin = new Vector2(0, 1),
                    DrawOrder = 0.6f,
                    Y = 480,
                })
                .AddComponent(new Sprite("Content/LoadingSpankerImg"))
                .AddComponent(new AnimationUI())
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            EntityManager.Add(tower);

            text = new Entity()
                .AddComponent(new Transform2D()
                {
                    DrawOrder = 0.9f,
                    Rotation = MathHelper.ToRadians(-45),
                    XScale = 2f,
                    YScale = 2f,
                })
                .AddComponent(new Sprite("Content/LoadingSpankerText"))
                .AddComponent(new AnimationUI())
                .AddComponent(new SpriteRenderer(DefaultLayers.Alpha));

            EntityManager.Add(text);
        }
Esempio n. 25
0
        protected override void CreateScene()
        {
            FixedCamera2D camera2d = new FixedCamera2D("camera");
            camera2d.BackgroundColor = Color.Gray;
            EntityManager.Add(camera2d);

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

            gridPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });
            gridPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });
            gridPanel.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Proportional) });

            gridPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) });
            gridPanel.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Proportional) });

            // Elements
            Button button;
            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 2; j++)
                {
                    button = new Button()
                    {
                        Text = "[" + i + "," + j + "]",
                        HorizontalAlignment = HorizontalAlignment.Center,
                        VerticalAlignment = VerticalAlignment.Center,
                        Width = 100,
                        Height = 100,
                        Foreground = Color.Yellow,
                        BackgroundColor = Color.Red,
                    };
                    button.SetValue(GridControl.RowProperty, i);
                    button.SetValue(GridControl.ColumnProperty, j);
                    gridPanel.Add(button);
                }
            }

            // Debug
            this.CreateDebugMode();
        }
Esempio n. 26
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.CreateUI();

            // Animations
            float viewportWidthOverTwo = WaveServices.ViewportManager.VirtualWidth / 2;
            Duration duration = TimeSpan.FromSeconds(1);
            this.superAppear = new SingleAnimation(-viewportWidthOverTwo, viewportWidthOverTwo, duration, EasingFunctions.Back);
            this.squidAppear = new SingleAnimation(WaveServices.ViewportManager.VirtualWidth * 2, viewportWidthOverTwo, duration, EasingFunctions.Back);
            this.playScaleAppear = new SingleAnimation(0.2f, 1f, TimeSpan.FromSeconds(2), EasingFunctions.Back);
            this.playOpacityAppear = new SingleAnimation(0, 1, duration, EasingFunctions.Cubic);
        }
Esempio n. 27
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()
        {
            // Creates the 2D camera
            var camera2D = new FixedCamera2D("Camera2D"); // { ClearFlags = ClearFlags.DepthAndStencil }; // Transparent background need this clearFlags.
            this.EntityManager.Add(camera2D);

            // Starts Kinect Service Sensor
            var kinectService = WaveServices.GetService<KinectService>();
            kinectService.StartSensor(KinectSources.Color | KinectSources.Body);

            // Creates Kinect Color Image Entity
            Entity kinectBackground = new Entity()
                .AddComponent(new Transform2D())
                .AddComponent(new Sprite(kinectService.ColorTexture))
                .AddComponent(new SpriteRenderer());
            this.EntityManager.Add(kinectBackground);
        }
Esempio n. 28
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);
        }
Esempio n. 29
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();
        }
Esempio n. 30
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));         
        }