示例#1
0
        /// <summary>
        /// 得到当前玩家的数据包
        /// </summary>
        /// <returns></returns>
        public PlayerData GetPlayerData()
        {
            var playerData = new PlayerData {
                Name = name,
                Growth = growth,
                Experience = experience,
                Level = Level,
                Strength = Strength,
                Agility = Agility,
                Intelligence = Intelligence,
                CurrentHP = currentHP,
                Deck = deck,
                Skills = skills
            };

            return playerData;
        }
 public PlayerController()
 {
     data = new PlayerData();
     players = ReadPlayers();
 }
示例#3
0
        /// <summary>
        /// 从数据生成玩家对象
        /// </summary>
        /// <param name="data">数据类</param>
        /// <returns></returns>
        public static Player LoadFromData(PlayerData data)
        {
            var player = new Player();
            player.name = data.Name;
            player.growth = data.Growth;
            player.experience = data.Experience;
            player.Level = data.Level;
            player.Strength = data.Strength;
            player.Agility = data.Agility;
            player.Intelligence = data.Intelligence;
            player.currentHP = data.CurrentHP;
            player.deck = data.Deck;
            player.skills = data.Skills;

            return player;
        }