예제 #1
0
        public override void LoadContent()
        {
            base.LoadContent();
            mEndGameTexture = TextureManager.Instance.GetElementByString("endgame");
            //Logic
            mLogic.LoadContent(mHansel, mGretel);
            //Player
            mHansel.LoadContent();
            mGretel.LoadContent();
            mHansel.mCurrentActivity = ActivityHandler.None;
            mGretel.mCurrentActivity = ActivityHandler.None;
            mHansel.LoadReferences(mCamera, mGretel);
            mGretel.LoadReferences(mCamera, mHansel);
            mHansel.ApplySettings();
            mGretel.ApplySettings();
            //Savegame
            mSavegame = Savegame.Load(mHansel, mGretel);
            mScene    = mSavegame.Scenes[mSavegame.SceneId];
            mRenderer.AmbientLight = mScene.SceneAmbientLight;
            //Camera
            mCamera.GameScreen = mScene.GamePlane;
            //Set ActivityStates in IObjs
            mLogic.ActivityHandler.SetupInteractiveObjectsFromDeserialization(mSavegame, mHansel, mGretel);
            //PauseMenu
            mPauseMenu.LoadContent();
            mHansel.Lantern = true;

            GameReferenzes.ReferenzHansel = mHansel;
            GameReferenzes.ReferenzGretel = mGretel;
            GameReferenzes.GameCamera     = mCamera;
            GameReferenzes.Level          = mScene;

            GameReferenzes.SceneID = mSavegame.SceneId;

            AIManager.Instance.ChangeMap(mCamera.GameScreen, mScene.MoveArea);

            foreach (InteractiveObject iobj in mScene.InteractiveObjects)
            {
                AIManager.Instance.SetInterActiveObjects(mScene.InteractiveObjects);
            }

            AIManager.Instance.SetAgents(mScene.Enemies);
        }
예제 #2
0
        /// <summary>
        ///     Updates the initc.txt in the current directory with the detected profile's campaign progress.
        /// </summary>
        private void HandleCheckpoint()
        {
            if (_configuration.SkipResume)
            {
                return;
            }

            Notify("----------------------------");
            Notify("Initiated progress handle...");
            Notify("----------------------------");

            /**
             * Loader is assumed to be running from the working directory, where both the executable & initc reside in.
             */
            Notify("Infer init in working dir...");
            var initc = new Initc((File)"initc.txt");

            /**
             * Savegame binary ends up being the one detected on the filesystem.
             * Detection is implicitly done by attempting to figure out the profile's name.
             */
            Notify("Infer savegame in profile...");
            string saveName;

            try
            {
                saveName = LastprofFactory.DetectOnSystem().Name;
            }
            catch (FileNotFoundException)
            {
                Notify("Could not resolve profile...");
                Notify("Assuming fresh initiation...");
                return;
            }

            var personal = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var gamesHce = Path.Combine("My Games", "Halo CE");
            var savePath = Path.Combine(personal, gamesHce, "savegames", saveName, "savegame.bin");
            var saveGame = new Savegame((File)savePath);

            Progress progress;

            try
            {
                Notify("Infer saved progress data...");
                progress = saveGame.Load();
            }
            catch (ArgumentException)
            {
                Notify("Could not decode the data...");
                Notify("Assuming fresh checkpoint...");
                Notify("Will skip checkpoint commit!");
                return;
            }

            Notify("Commit checkpoint to init...");
            initc.Save(progress);

            Notify("----------------------------");
            Notify("Completed progress handle...");
            Notify("----------------------------");
        }