Beispiel #1
0
        // ===============================================================================
        // FUNCTIONS
        // ===============================================================================

        // -------------------------------------------------------------------------------
        // AddHero
        // -------------------------------------------------------------------------------
        public void AddHero(TemplateCharacterHero tmpl)
        {
            CharacterHero player = new CharacterHero
            {
                template = tmpl
            };

            player.DefaultInitialize();
            characters.Add(player);
            OnPropertyChanged("Member");
        }
Beispiel #2
0
        // -------------------------------------------------------------------------------
        // LoadState
        // -------------------------------------------------------------------------------
        public void LoadState(int index)
        {
            Savegame state = Load(index);

            if (state != null)
            {
                // -------------------------------------------------------------------------------
                // Restore: Currencies
                // -------------------------------------------------------------------------------
                Finder.party.currencies.gold = state.gold;

                // -------------------------------------------------------------------------------
                // Restore: Interacted & Deactivated Objects
                // -------------------------------------------------------------------------------
                Finder.party.InteractedObjects  = state.InteractedObjects;
                Finder.party.DeactivatedObjects = state.DeactivatedObjects;

                // -------------------------------------------------------------------------------
                // Restore: Exploration Data
                // -------------------------------------------------------------------------------
                Finder.party.MapExplorationInfo  = state.MapExplorationInfo;
                Finder.party.TownExplorationInfo = state.TownExplorationInfo;

                // -------------------------------------------------------------------------------
                // Restore: Party Equipment
                // -------------------------------------------------------------------------------
                Finder.party.equipment = state.equipment;
                Finder.party.equipment.LoadTemplates();

                // -------------------------------------------------------------------------------
                // Restore: Party Inventory
                // -------------------------------------------------------------------------------
                Finder.party.inventory = state.inventory;
                Finder.party.inventory.LoadTemplates();

                // -------------------------------------------------------------------------------
                // Restore: Characters in Party
                // -------------------------------------------------------------------------------
                Finder.party.characters.Clear();
                foreach (SavegameCharacter character in state.characters)
                {
                    CharacterHero hero = new CharacterHero();
                    hero.LoadFromSavegame(character);
                    Finder.party.characters.Add(hero);
                }

                // -------------------------------------------------------------------------------
                // Restore: Last visited Town
                // -------------------------------------------------------------------------------
                if (!string.IsNullOrEmpty(state.lastTown))
                {
                    Finder.party.lastTown = DictionaryTown.Get(state.lastTown);
                }

                // -------------------------------------------------------------------------------
                // Restore: Current Location
                // -------------------------------------------------------------------------------
                Location restoredLocation = new Location
                {
                    locationType    = state.locationType,
                    name            = state.mapName,
                    facingDirection = state.facingDirection,
                    X = state.X,
                    Y = state.Y
                };

                Finder.battle.Reset();
                Finder.ui.DeactivateAll();
                Finder.audio.StopBGM();
                Finder.audio.StopSFX();

                SaveDate        = state.SaveDate;
                StartDate       = state.StartDate;
                LastLoadedIndex = index;

                Finder.map.TeleportPlayer(restoredLocation);

                GameInProgress = true;
            }
        }