Esempio n. 1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            InputHandler();
            Renderer.GraphicOptions.FrameLength = (float)gameTime.ElapsedGameTime.TotalSeconds;
            renderer.Update();
            colorTimer += gameTime.ElapsedGameTime.Milliseconds;
            if (colorTimer > 10.0f)
            {
                colorTimer = 0.0f;
                switch (colorState)
                {
                case ColorStateEnum.RED:
                    if (meshColor.R == 255)
                    {
                        colorState = ColorStateEnum.GREEN;
                    }
                    else
                    {
                        meshColor.R++; meshColor.B--;
                    }
                    break;

                case ColorStateEnum.GREEN:
                    if (meshColor.G == 255)
                    {
                        colorState = ColorStateEnum.BLUE;
                    }
                    else
                    {
                        meshColor.G++; meshColor.R--;
                    }
                    break;

                case ColorStateEnum.BLUE:
                    if (meshColor.B == 255)
                    {
                        colorState = ColorStateEnum.RED;
                    }
                    else
                    {
                        meshColor.B++; meshColor.G--;
                    }
                    break;
                }


                if (tank != -1)
                {
                    renderer.ActiveScene.Access3D(tank).MeshColor = meshColor;
                }

                if (turret != -1)
                {
                    renderer.ActiveScene.Access3D(turret).MeshColor = meshColor;
                }
            }
            //base.Update(gameTime);
        }
Esempio n. 2
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     contentBuilder = new ContentBuilder();
     overhead = true;
     emitterAdded = false;
     colorTimer = 0;
     colorState = ColorStateEnum.RED;
     meshColor = Color.Blue;
     graphics.PreparingDeviceSettings += this.graphics_PreparingDeviceSettings;
 }
Esempio n. 3
0
 public Game1()
 {
     graphics       = new GraphicsDeviceManager(this);
     contentBuilder = new ContentBuilder();
     overhead       = true;
     emitterAdded   = false;
     colorTimer     = 0;
     colorState     = ColorStateEnum.RED;
     meshColor      = Color.Blue;
     graphics.PreparingDeviceSettings += this.graphics_PreparingDeviceSettings;
 }
Esempio n. 4
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            InputHandler();
            Renderer.GraphicOptions.FrameLength = (float)gameTime.ElapsedGameTime.TotalSeconds;
            renderer.Update();
            colorTimer += gameTime.ElapsedGameTime.Milliseconds;
            if (colorTimer > 10.0f)
            {
                colorTimer = 0.0f;
                switch (colorState)
                {
                    case ColorStateEnum.RED:
                        if (meshColor.R == 255) colorState = ColorStateEnum.GREEN;
                        else { meshColor.R++; meshColor.B--; }
                        break;
                    case ColorStateEnum.GREEN:
                        if (meshColor.G == 255) colorState = ColorStateEnum.BLUE;
                        else { meshColor.G++; meshColor.R--; }
                        break;
                    case ColorStateEnum.BLUE:
                        if (meshColor.B == 255) colorState = ColorStateEnum.RED;
                        else { meshColor.B++; meshColor.G--; }
                        break;
                }

                if (tank != -1)
                {
                    renderer.ActiveScene.Access3D(tank).MeshColor = meshColor;
                }

                if (turret != -1)
                {
                    renderer.ActiveScene.Access3D(turret).MeshColor = meshColor;
                }
            }
            //base.Update(gameTime);
        }