Exemplo n.º 1
0
        /// <summary>
        ///     Called when simulation is about to destroy itself, but right before it actually does it.
        /// </summary>
        protected override void OnPreDestroy()
        {
            // Notify modules of impending doom allowing them to save data.
            Scoring.Destroy();
            Tombstone.Destroy();
            Time.Destroy();
            EventDirector.Destroy();
            Trail.Destroy();

            // Null the destroyed instances.
            Scoring = null;
            Tombstone = null;
            Time = null;
            EventDirector = null;
            Trail = null;
            TotalTurns = 0;
            Vehicle = null;

            // Destroys game simulation instance.
            Instance = null;
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Creates and or clears data sets required for game simulation and attaches the travel menu and the main menu to make
        ///     the program completely restarted as if fresh.
        /// </summary>
        public override void Restart()
        {
            // Reset turn counter back to zero.
            TotalTurns = 0;

            // Linear time simulation (should tick first).
            Time = new TimeModule();

            // Vehicle, weather, conditions, climate, tail, stats, event director, etc.
            EventDirector = new EventDirectorModule();
            Trail = new TrailModule();
            Vehicle = new Vehicle();

            // Resets the window manager in the base simulation.
            base.Restart();

            // Attach traveling Windows since that is the default and bottom most game Windows.
            WindowManager.Add(typeof(Travel));

            // Add the new game configuration screen that asks for names, profession, and lets user buy initial items.
            WindowManager.Add(typeof(MainMenu));
        }