public override void LoadData(Save data) { for (int i = 0; i < this.events.Count; i++) { this.events[i].DoneOnce = data.eventsDone[i]; } for (int i = 0; i < this.Teams.Count; i++) { for (int q = 0; q < this.Teams[i].members.Count; q++) { Save.SavedCharacterGamePlay savedChara = data.teams[i].characters.Find(item => item.id == this.Teams[i].members[q].id); if (savedChara != null) { this.Teams[i].members[q].LoadSaveData(savedChara); this.Teams[i].members[q].stats.CalculateStats(); } } } TurnManager.TurnNumber = data.MissionTurn; TurnManager.currentTeam = data.CurrentTeamIndex; }
public void LoadSaveData(Save.SavedCharacterGamePlay SavedChara) { this.isUnique = SavedChara.isUnique; List <int> equipbables = SavedChara.SavedStats.CanEquipWeapons.Select(item => (int)item).ToList(); this.stats = new Stats(this._Name, 0, SavedChara.SavedStats.BaseHP, SavedChara.SavedStats.BaseMP, SavedChara.SavedStats.BaseAttack, SavedChara.SavedStats.BaseDef, SavedChara.SavedStats.BaseSpeed, SavedChara.SavedStats.Gear.Clone(), equipbables, this); this.stats.SetCurrentHP(SavedChara.currentHp); this.stats.SetCurrentMP(SavedChara.currentMP); Inventory newInventory = new Inventory(SavedChara.SavedInventory.Items.Select(item => item.Duplicate()).ToList()); this.inventroy = newInventory; this.spawned = SavedChara.isSpawned; this.TurnActionsPreformed = SavedChara.TurnActionsPreformed; this.onStartPath = SavedChara.onStartPath.Select(item => item.Clone()).ToList(); this.Position = SavedChara.currentPosition.Clone(); this.SpawnDirection = (GameGrid.BlockDirections.FaceDirections)SavedChara.SpawnDirection; if (SavedChara.isSpawned) { this.SpawnPositon = SavedChara.currentPosition.Clone(); spawnOverride = true; } }