예제 #1
0
    private void Update()
    {
        if (_player.IsDead)
        {
            return;
        }

        EffectsUpdate();
        SkillsUpdate();

        if (_monster.IsDead)
        {
            var drop = _monster.GetDrop();
            _player.TakeDrop(drop);
            _locationService.MonsterKilled();
            // FarmForm.UpdateDropInfo(new DropInfo(_monster, drop));
            NewMonster();
        }

        // Обновление кастуемого скилла монстра.
        _monsterSkillService.Update(_player, Time.deltaTime);
        if (_monsterSkillService.IsCasting)
        {
            var castingSkill = _monsterSkillService.GetCastingSkill();
            MonsterCastingSkillSlot.gameObject.SetActive(true);
            UpdateSkillSlot(castingSkill, MonsterCastingSkillSlot, MonsterCastingSkillCooldownBar);
        }
        else
        {
            MonsterCastingSkillSlot.gameObject.SetActive(false);
        }

        MonsterHealthBar.UpdateBar(_monster.Health, _monster.MaxHealth);
        MonsterDescription.text = _monster.ToString();
        PlayerHealthBar.UpdateBar(_player.Health, _player.GetMaxHealth());
        ExpBar.UpdateBar(_player.Exp, _player.ExpForNextLevel);

        LevelText.text = $"Level: {_player.Level.ToString()}";
        GoldText.text  = _player.Inventory.Gold.ToString();

        UpdateFightBoss();
    }