Beispiel #1
0
    /// <summary>
    /// Attack Decision Tree
    /// </summary>
    private IEnumerator AttackDecision()
    {
        player Player = LevelManager.Instance.Player;

        if (IsInAttackRange(Player) && enemy.Ap >= 1 && mode == EnemyMode.Chasing)
        {
            transform.LookAt(Player.transform, Vector3.up);
            EnemyManager.Instance.AttackPop(transform);

            yield return(new WaitForSeconds(1.5f));

            //gameObject.GetComponent<AudioSource>().PlayOneShot(SwingSword);
            SoundManager.Instance.Attack();
            Player.Shaking(0.07f, 0.08f);
            SoundManager.Instance.Hurt();
            Player.ApplyDamage(enemy.Statistics.CalculateDamageOutput(enemy.Attack));
            enemy.Statistics.ApplyFatigue(1);

            CurrentEnemyState = EnemyState.Deactivated;
        }
    }