コード例 #1
0
ファイル: MainScene.cs プロジェクト: BrockDierksen/Samples
        /// <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());
                });
        }
コード例 #2
0
ファイル: MainScene.cs プロジェクト: frodo5654/Samples
        /// <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());
            });
        }