예제 #1
0
        private void setupSinglePlayerRace(RaceEventConfig eventCfg)
        {
            _game.State.Paused = true;

            setupRace(eventCfg);

            cameraTargetPlayerCar(true);

            _isAIRace = false;

            RaceUI.Show(_race);
            _game.State.Paused = false;
        }
예제 #2
0
        protected void clearRoom()
        {
            clearRace();

            RaceUI.Clear();
            _viewMan = null;

            _aiRegionBased = null;
            _aiPathBased   = null;

            _race          = null;
            _track         = null;
            _startingGrid  = null;
            _lapTestRegion = new Vecregion();
        }
예제 #3
0
        private void onLoad()
        {
            /* TODO:
             * FadeOut(0);
             * StopAllAudio();
             */

            RaceUI.Init(_game);

            RaceEventConfig cfg = LF.Menu.RaceConfig;

            cfg.PlayerDriver = -1;                          // no player
            cfg.Opponents    = LF.RaceAssets.Drivers.Count; // max drivers
            cfg.Laps         = 0;                           // drive forever
            setupAIRace(cfg);
            _music.Play(true);

            GameStateManager.PushState(this);
        }
예제 #4
0
        private void clearRace()
        {
            RaceUI.Hide();

            if (_tChangeAICamera != null)
            {
                _tChangeAICamera.Dispose();
            }
            _tChangeAICamera = null;
            if (_viewMan != null)
            {
                _viewMan.ResetToSingleViewport();
            }
            _game.State.Viewport.Pivot = new PointF();

            if (_race != null)
            {
                _race.Clear();
            }

            _ai = null;

            _raceStartSequence = 0;
            _raceEndSequence   = 0;

            if (_bannerTimer != null)
            {
                _bannerTimer.Dispose();
            }
            _bannerTimer = null;
            if (_bannerTween != null)
            {
                _bannerTween.Stop(TweenCompletion.Stay);
            }
            _bannerTween = null;
            if (_banner != null)
            {
                _game.State.UI.Remove(_banner);
            }
            _banner = null;
        }
예제 #5
0
        public void RepExec(float deltaTime)
        {
            // TODO: temp, remove/change
            IInput input = _game.Input;

            if (input.IsKeyDown(Key.PageDown))
            {
                _game.State.Viewport.ScaleX = _game.State.Viewport.ScaleY = _game.State.Viewport.ScaleX - 0.02F;
            }
            if (input.IsKeyDown(Key.PageUp))
            {
                _game.State.Viewport.ScaleX = _game.State.Viewport.ScaleY = _game.State.Viewport.ScaleX + 0.02F;
            }
            if (input.IsKeyDown(Key.Insert))
            {
                _game.State.Viewport.Angle += 1F;
            }
            if (input.IsKeyDown(Key.Delete))
            {
                _game.State.Viewport.Angle -= 1F;
            }

            if (_raceStartSequence > 0)
            {
                return; // wait until sequence ends
            }
            _race.Run(deltaTime);

            // TODO: move to Race class at some point
            testLapComplete();

            if (RaceUI.IsShown)
            {
                RaceUI.Update();
            }
        }