Esempio n. 1
0
        public static void StartGame(string name)
        {
            try
            {
                GameManager.LPlayers = DataXML.Load("Scores.xml");
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception error=>" + e.Message);
            }

            Player player = SearchPlayer(name);

            if (player != null)
            {
                if (player.IsDead())
                {
                    CurrentPlayer = new Player(name, 100);
                }
                else
                {
                    CurrentPlayer = player;
                }
            }
            else
            {
                CurrentPlayer = new Player(name, 100);
            }
        }
Esempio n. 2
0
        public static void SaveGame()
        {
            CurrentPlayer.Enemy = null;
            Player player = SearchPlayer(CurrentPlayer.Name);

            if (player != null)
            {
                if (player.GP < CurrentPlayer.GP || player.IsDead())
                {
                    LPlayers.Remove(player);
                    LPlayers.Add(CurrentPlayer);
                }
            }
            else
            {
                LPlayers.Add(CurrentPlayer);
            }
            DataXML.Save("Scores.xml", LPlayers);
        }