public override bool Update(float deltaTime, float gameTime)
        {
            if (_screenActive)
            {
                switch (_cinematicState)
                {
                case CinematicState.StageDisplay:
                    UpdateStageDisplay(deltaTime);
                    break;

                case CinematicState.PlayerMoveToPosition:
                    UpdatePlayerMoveToPosition(deltaTime);
                    break;

                case CinematicState.Climbing:
                    UpdatePlayerClimbing(deltaTime);
                    break;

                case CinematicState.PlayerReachedTop:
                    UpdatePlayerReachedTop(deltaTime);
                    break;

                case CinematicState.PlayerJump:
                    UpdatePlayerJump(deltaTime);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                foreach (Audience audience in _audiences)
                {
                    audience.Update(deltaTime, gameTime);
                }
            }

            _booTimer -= deltaTime;
            if (_booTimer <= 0)
            {
                _booTimer = ExtensionFunctions.RandomInRange(GameInfo.CinematicBooMinTime,
                                                             GameInfo.CinematicBooMaxTime);
                SoundManager.Instance.PlaySound(_booSoundEffect);
            }

            _starSpriteSheetAnimationManager.Update(deltaTime);
            _playerSprite.SpriteColor = _playerFlasher.Update(deltaTime);

            return(_exitScreen);
        }
Exemple #2
0
        public void Update(float deltaTime, float gameTime)
        {
            if (_useAsDummy)
            {
                return;
            }

            UpdateDurations(deltaTime);

            if (_playerGameObject.Velocity.Y < GameInfo.PlayerMaxYVelocity)
            {
                _playerGameObject.UpdateOnlyVelocity(deltaTime, gameTime);
            }

            _playerGameObject.Sprite.SpriteColor = _playerColorFlasher.Update(deltaTime);

            _playerController.Update();

            if (_playerGameObject.Position.X < GameInfo.PlayerLeftPosition)
            {
                _playerGameObject.Position = new Vector2(GameInfo.PlayerLeftPosition, _playerGameObject.Position.Y);
            }
            else if (_playerGameObject.Position.X > GameInfo.PlayerRightPosition)
            {
                _playerGameObject.Position = new Vector2(GameInfo.PlayerRightPosition, _playerGameObject.Position.Y);
            }
            else if (_playerGameObject.Position.Y < GameInfo.PlayerMinYPosition)
            {
                _playerGameObject.Position = new Vector2(_playerGameObject.Position.X, GameInfo.PlayerMinYPosition);
            }
            else if (_playerGameObject.Position.Y > GameInfo.PlayerMaxYPosition)
            {
                _playerGameObject.Position = new Vector2(_playerGameObject.Position.X, GameInfo.PlayerMaxYPosition);
            }

            HandleInput(deltaTime);
            UpdateSpriteSheet(deltaTime);
        }