#region File Description //----------------------------------------------------------------------------- // PlayerSaveData.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion #region Using Statements using System; using System.Collections.Generic; using RolePlayingGameData; #endregion namespace RolePlaying { /// /// Serializable data for the state of a player. /// public class PlayerSaveData { /// /// The asset name of the player itself. /// public string assetName; /// /// The character level of the player. /// public int characterLevel; /// /// The experience gained by the player since their last level. /// public int experience; /// /// The asset names of the equipped gear. /// public List equipmentAssetNames = new List(); /// /// All permanent statistics modifiers to the character (i.e. damage). /// public StatisticsValue statisticsModifiers; #region Initialization /// /// Creates a new PlayerData object. /// public PlayerSaveData() { } /// /// Creates a new PlayerData object from the given Player object. /// public PlayerSaveData(Player player) : this() { // check the parameter if (player == null) { throw new ArgumentNullException("player"); } assetName = player.AssetName; characterLevel = player.CharacterLevel; experience = player.Experience; foreach (Equipment equipment in player.EquippedEquipment) { equipmentAssetNames.Add(equipment.AssetName); } statisticsModifiers = player.StatisticsModifiers; } #endregion } }