Пример #1
0
        public static void StartNewBattle(PartyClass playerParty, PartyClass enemyParty)
        {
            // If either are null, exit this class
            if (playerParty == null || enemyParty == null)
            {
                throw new InvalidOperationException("PlayerParty or EnemyParty is null!");
            }
            // check if we are already in battle
            if (singleton != null)
            {
                throw new InvalidOperationException("There can only be one battle at a time.");
            }

            singleton = new BattleEngine(playerParty, enemyParty);
        }
Пример #2
0
 /// <summary>
 /// Ensure that there is no battle happening right now.
 /// </summary>
 public static void ClearBattle()
 {
     // Clear the singleton
     if (singleton != null)
     {
         singleton = null;
     }
 }