public void SaveGame(Player player, string path) { using (Stream stream = File.Open(path, FileMode.Create)) { BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, player); } }
public Battle(Player currentplayer, Monster monster) { player = currentplayer; this.monster = monster; playerTimer = monsterTimer = 0; nextAction = CombatAction.Attack; nextActionItem = player.EquippedWeapon; }
public Player StartGame(string name) { List<Item> inventory = new List<Item>(); inventory.Add(getItem(7)); Weapon weapon = (Weapon)getItem(-1); Armour armour = (Armour)getItem(-2); WarriorStats playerStats = new WarriorStats() { Accuracy = 80, MaxHp = 10, Hp = 10, Level = 1, Strength = 3, Speed = 7 }; Player player = new Player(name, playerStats, inventory, weapon, armour) { Gold = 1001 }; GameInProgress = true; return player; }