コード例 #1
0
ファイル: CombatUI.cs プロジェクト: Molefishbob/Necrox
    void EnemyAttack()
    {
        if (attackComplete)
        {
            attackComplete = false;
            gameObject.GetComponent <Timer>().SetTime(enemyAtkTime);
            gameObject.GetComponent <Timer>().StartTimer();
        }
        if (gameObject.GetComponent <Timer>().IsCompleted)
        {
            _camera.GetComponent <CameraManager>()
            .PlaySound(enemy.GetComponent <WeaponSound>()._weaponSound, GameManager._soundVolume, usePitchVariance: true);

            attackComplete = true;
            enemy.GetComponent <Animator>().SetTrigger("Attack");
            if (earthBool)
            {
                Destroy(EarthShield);
                float temp = (float)(enemyDmg * (1 - earthStack));
                _necromancer.ShowDamageText(temp);
                MainCharHealth.value -= temp;
                Instantiate(enemyDmgFeedback);
                FindObjectOfType <TakeDamage>().StartFlash();
                earthBool  = false;
                earthStack = 0;
            }
            else
            {
                float temp = enemyDmg;
                _necromancer.ShowDamageText(temp);
                MainCharHealth.value -= temp;
                Instantiate(enemyDmgFeedback);
                FindObjectOfType <TakeDamage>().StartFlash();
            }
        }
    }