예제 #1
0
        public override void OnEntry(GameTime gameTime)
        {
            tPopup = null;
            end    = false;
            MouseEventDispatcher.OnMousePress     += OnMP;
            KeyboardEventDispatcher.OnKeyPressed  += OnKP;
            KeyboardEventDispatcher.OnKeyReleased += OnKR;
            DevConsole.OnNewCommand += DevConsole_OnNewCommand;

            team = 0;
            type = 0;

            state             = game.LoadScreen.LoadedState;
            state.OnNewPopup += OnNewPopup;
            camera            = game.LoadScreen.LoadedCamera;
            renderer          = game.LoadScreen.LoadedRenderer;
            renderer.UseFOW   = true;
            gameInput         = (from t in state.teams
                                 where t.Input != null && t.Input.Type == RTSInputType.Player
                                 select t.Input).FirstOrDefault();
            vInput         = gameInput == null ? null : gameInput as IVisualInputController;
            playController = game.LoadScreen.LoadedGPlay;

            sfDebug = renderer.LoadFont(@"Fonts\CourierNew32");


            // Create Game Engine Thread
            playController.BeginPlaying(state);
            tEngine          = new Thread(EngineThread);
            tEngine.Priority = ThreadPriority.Highest;
            tEngine.TrySetApartmentState(ApartmentState.MTA);
            tEngine.IsBackground = true;
            playing     = 1;
            pauseEngine = false;
            pauseRender = false;
            tEngine.Start();

            // Create Background Music
            jukeBox = new Jukebox();
            jukeBox.LoadFromDirectory(new DirectoryInfo(BS_SOUND_DIR));
        }