ShaderController.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    void Update()
    {
        rend.material.SetFloat ("_SliderValue", sliderPosition);
    }

Usage Example

Example #1
0
        public override void Update(GameTime gameTime)
        {
            if (levelState == LevelState.Active)
            {
                foreach (Gem gem in gems)
                {
                    gem.Update(gameTime);
                }
                int       i            = 0;
                Rectangle boundingRect = hero.GetBoundingRect(hero.rect);

                while (i < gems.Count)
                {
                    if (gems[i].rect.Intersects(boundingRect))
                    {
                        gems.RemoveAt(i);
                        Score += 100;
                        sound.Play();
                        if (gems.Count == 0)
                        {
                            quit.quitPortalSound.Play();
                            quit.quitSound.Play();
                            quit.OpenPortal();
                        }
                    }
                    else
                    {
                        i++;
                    }
                }
                enter.Update(gameTime);
                hero.Update(gameTime);
                quit.Update(gameTime);
                shader.Update(gameTime);
                background.Update(gameTime);

                try
                {
                    foreach (AnimatedSprite enemy in enemies)
                    {
                        Rectangle enemyBoundingRect = enemy.GetBoundingRect(enemy.rect);
                        if (enemyBoundingRect.Intersects(boundingRect))
                        {
                            hero.health -= enemy.power * (float)gameTime.ElapsedGameTime.Ticks / 1000000;
                            if (hero.health <= 0)
                            {
                                Score = 0;
                                CreateLevel(0);
                            }
                        }
                        enemy.Update(gameTime);
                    }
                }
                catch (InvalidOperationException) { }

                /// Keys Event Handler For Level
                /// Новый уровень
                if (InputManager.IsKeyPress(Keys.Space))
                {
                    CreateLevel(2);
                }

                /// Пауза
                if (InputManager.IsKeyPress(Keys.P))
                {
                    oldLevelState = levelState;
                    levelState    = LevelState.Paused;
                }

                /// Выход в главное меню
                if (InputManager.IsKeyDown(Keys.Escape))
                {
                    oldLevelState = levelState;
                    levelState    = LevelState.Paused;
                    Game.Components.Add(new Transition(Game, null, new Menu(Game)));
                }
            }
            else
            {
                UpdateActiveUnits(gameTime);
            }
        }