Ejemplo n.º 1
0
        /// <summary>
        /// Create Scene
        /// </summary>
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.CornflowerBlue;
            RenderManager.DebugLines = true;

            // Createa a Free Camera (W, A, S, D Keyboard controlled)
            FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 5, 10), Vector3.Zero);
            EntityManager.Add(camera.Entity);
            RenderManager.SetActiveCamera(camera.Entity);

            // Creates a plane ground
            this.CreateGround();

            // Creates Line Drawing Entity
            drawableLines = new DrawableLines();
            Entity lines = new Entity("Drawables")
                .AddComponent(drawableLines);
            EntityManager.Add(lines);

            // Create a Timer to instance new Sphere each 0.5 seconds
            WaveServices.TimerFactory.CreateTimer("MainTimer", TimeSpan.FromSeconds(0.5f), () =>
                {
                    // new sphere in (random(0,1), 5, random(0, 1)) position
                    this.CreateSphere(Vector3.Up * 5 + Vector3.Forward*(float)WaveServices.Random.NextDouble() + Vector3.Left*(float)WaveServices.Random.NextDouble());
                });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create Scene
        /// </summary>
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.CornflowerBlue;
            RenderManager.DebugLines      = true;

            // Createa a Free Camera (W, A, S, D Keyboard controlled)
            FreeCamera camera = new FreeCamera("MainCamera", new Vector3(0, 5, 10), Vector3.Zero);

            EntityManager.Add(camera.Entity);
            RenderManager.SetActiveCamera(camera.Entity);

            // Creates a plane ground
            this.CreateGround();

            // Creates Line Drawing Entity
            drawableLines = new DrawableLines();
            Entity lines = new Entity("Drawables")
                           .AddComponent(drawableLines);

            EntityManager.Add(lines);

            // Create a Timer to instance new Sphere each 0.5 seconds
            WaveServices.TimerFactory.CreateTimer("MainTimer", TimeSpan.FromSeconds(0.5f), () =>
            {
                // new sphere in (random(0,1), 5, random(0, 1)) position
                this.CreateSphere(Vector3.Up * 5 + Vector3.Forward * (float)WaveServices.Random.NextDouble() + Vector3.Left * (float)WaveServices.Random.NextDouble());
            });
        }