Exemplo n.º 1
0
 public void InitializeBattle(List <EnemyData> enemies, ActualTurn turn)
 {
     ControlManager.Instance.PlayerContext = PlayerContextType.InCombat;
     StatsManager.Instance.RecalculateStatsFromPlayer(); //loads stats + weapon
     _playerCombat = _combatUpdater.PlayerCombat;
     for (int i = 0; i < enemies.Count; i++)
     {
         if (enemies[i].TypeEnemy == TypeEnemy.Boss)
         {
             _bossBattle = true;
         }
         EnemyCombat ec = _combatUpdater.EnemiesSlots[i].GetComponent <EnemyCombat>();
         _enemiesInBattle.Add(i, ec);
         _enemiesInBattle[i].SetEnemyData(enemies[i], StatsManager.Instance.InfoPlayer.ActualLevel);
     }
     UIManager.Instance.ShowUIMainPanel(UIMainPanel.Combat);  //Combat panel -> 1st transit
     _actualTurn = turn;
 }
Exemplo n.º 2
0
 public void InitializeBattle()
 {
     ControlManager.Instance.PlayerContext = PlayerContextType.InCombat;
     StatsManager.Instance.RecalculateStatsFromPlayer(); //loads stats + weapon
     _playerCombat  = _combatUpdater.PlayerCombat;
     _enemyAttacked = -1;
     for (int i = 0; i < _enemiesAddToBattle.Count; i++)
     {
         if ((int)_enemiesAddToBattle[i].TypeEnemy >= 100)
         {
             _bossBattle = true;
         }
         EnemyCombat ec = _combatUpdater.EnemiesSlots[i].GetComponent <EnemyCombat>();
         _enemiesInCombat.Add(ec);
         _enemiesAlive.Add(true);
         _enemiesInCombat[i].SetEnemyData(_enemiesAddToBattle[i], StatsManager.Instance.InfoPlayer.ActualLevel);
     }
     UIManager.Instance.ShowUIMainPanel(UIMainPanel.Combat);  //Combat panel -> 1st transit
     _actualTurn = _preloadTurn;
 }
Exemplo n.º 3
0
 private void BattleEnded()
 {
     if (_playerIsDead)
     {
         _expGained  = Mathf.RoundToInt(_expGained * 0.5f);
         _goldGained = Mathf.RoundToInt(_goldGained * 0.5f);
     }
     if (_bossBattle == true)
     {
         if (!(InventoryManager.Instance.PlayerHas("The Golden Key") ||
               StatsManager.Instance.InfoPlayer.IsGameEnded == true))
         {
             InfoItem key = new InfoItem();
             key.SetValues("The Golden Key", TypeItem.Important, "A forgotten key, cursed, everyone who touched it before is now dead", ConsumeEffect.None, 0, 1, "/Items/Important/GoldenKey");
             if (InventoryManager.Instance.AvailableItemSpace > 0)
             {
                 InventoryManager.Instance.AddToInventory(key);
             }
         }
         _expGained  = Mathf.RoundToInt(_expGained * _playerCombat.LuckAfterBattle);
         _goldGained = Mathf.RoundToInt(_goldGained * _playerCombat.LuckAfterBattle);
     }
     DungeonManager.Instance.CombatEnded(_enemiesInCombat.Count, _playerIsDead);
     _actualTurn           = ActualTurn.None;
     _turnInProgress       = false;
     _playerIsDead         = false;
     _playerTurnInProgress = false;
     _combatUpdater.ResetSlots();
     _enemiesAlive.Clear();
     _enemiesInCombat.Clear();
     _enemiesAddToBattle.Clear();
     _bossBattle        = false;
     _preloadTurn       = ActualTurn.None;
     _startedBattle     = false;
     _canEnemiesBeAdded = false;
     _enemyAttacked     = -1;
     _enemyDoingAction  = -1;
     GameManager.Instance.SwapContextToDungeonFromCombat();
 }
Exemplo n.º 4
0
        private void ChangeTurn()
        {
            ActualTurn at = ActualTurn.None;

            switch (_actualTurn)
            {
            case ActualTurn.PlayerTurn:
            {
                if (_enemiesInBattle.Count > 0)
                {
                    at = ActualTurn.EnemyTurn;
                    _combatUpdater.DisableMenuCombatPlayer();
                }
                else
                {
                    _actualTurn = ActualTurn.BattleEnded;
                }
                break;
            }

            case ActualTurn.EnemyTurn:
            {
                if (_playerIsDead)
                {
                    at = ActualTurn.BattleEnded;
                }
                else
                {
                    at = ActualTurn.PlayerTurn;
                }
                break;
            }
            }
            _actualTurn = at;
            Debug.Log("El turno actual es de: " + _actualTurn);
            _turnInProgress = false;
        }
Exemplo n.º 5
0
        private void ChangeTurn()
        {
            ActualTurn at = ActualTurn.None;

            switch (_actualTurn)
            {
            case ActualTurn.PlayerTurn:
            {
                if (EnemiesStillAlive())
                {
                    at = ActualTurn.EnemyTurn;
                    _combatUpdater.DisableMenuCombat();
                }
                else
                {
                    at = ActualTurn.BattleEnded;
                }
                break;
            }

            case ActualTurn.EnemyTurn:
            {
                if (_playerIsDead)
                {
                    at = ActualTurn.BattleEnded;
                }
                else
                {
                    at = ActualTurn.PlayerTurn;
                }
                break;
            }
            }
            _actualTurn     = at;
            _turnInProgress = false;
        }