Пример #1
0
    private void Update()
    {
        if (_hasWon)
        {
            return;
        }

        bool isThereAnAliveEnemy = false;

        for (int i = 0; i < _enemyControllers.Length; i++)
        {
            if (_enemyControllers[i] != null && !_enemyControllers[i].isDead)
            {
                isThereAnAliveEnemy = true;
                break;
            }
        }
        if (!isThereAnAliveEnemy)
        {
            _hasWon = true;
            DataManager.AddPlayerMaxHealth(DataManager.GetMaxHPRewardForScene(GameManager.gameData.LoadedJamScene));
            JamSceneManager.LoadSceneWithDelay(JamScene.MainMenu, 2.0F);

            if (onPlayerWon != null)
            {
                onPlayerWon.Invoke();
            }
        }
    }
Пример #2
0
    private void Awake()
    {
        _jamScene = JamSceneManager.ConvertWorldLevelToJamScene(_world, _level);
        int maxHPReward = DataManager.GetMaxHPRewardForScene(_jamScene);
        int enemyHP     = DataManager.GetEnemyHPForScene(_jamScene);
        int enemyDmg    = DataManager.GetEnemyDmgForScene(_jamScene);

        _levelLabel.text = string.Format("{0}-{1}", _world, _level);

        _maxHPRewardLabel.text = string.Format("Max HP: +{0}", maxHPReward);

        _enemyHPLabel.text  = string.Format("HP: {0}", enemyHP);
        _enemyDmgLabel.text = string.Format("DMG: {0}", enemyDmg);
    }
Пример #3
0
 private void Update()
 {
     if (Input.GetKey(KeyCode.J) && Input.GetKey(KeyCode.K) &&
         (Input.GetKeyDown(KeyCode.Backspace) || Input.GetKeyDown(KeyCode.Delete)))
     {
         DataManager.SaveGameData(GameData.GetDefault());
         JamSceneManager.ReloadSceneWithDelay(0);
     }
     if (Input.GetKey(KeyCode.J) && Input.GetKeyDown(KeyCode.Insert))
     {
         GameManager.gameData.PlayerWeaponLvl = 2;
         GameManager.gameData.PlayerDamageLvl = 11;
         GameManager.gameData.PlayerMaxHealth = 777;
         DataManager.SaveGameData(GameManager.gameData);
         JamSceneManager.ReloadSceneWithDelay(0);
     }
 }
Пример #4
0
    public void TakeDamage(int damage)
    {
        if (_isDead)
        {
            return;
        }

        if (DataManager.TakeDamage(damage))
        {
            _isDead = true;

            _rb2d.velocity = Vector2.zero;
            _upperBodyController.Died();
            _lowerBodyController.Died();
            _lowerBodyController.SetMoving(false);
            JamSceneManager.LoadSceneWithDelay(JamScene.MainMenu, 1.0F);
        }

        DamageManager.DisplayDamageAt(damage, transform.position + _damageOffset);
    }
Пример #5
0
 public void PlayLevel()
 {
     JamSceneManager.LoadScene(_jamScene);
 }